pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Editable Table?
Date Tue, 08 Jun 2010 11:50:22 GMT
> Greg, the single-row edit model would work technically, but would be
> very inconvenient for users. Image order items displayed in a
> TableView...Users often need to change data in vertical manner, for
> example, to cancel some rows, or to set shipping fee to zero for some
> rows. In the single-row edit model, users would have to activate each
> row before editing, and would end up clicking twice as much.

Understood. However, a user can still only edit a single row at a time. Making them all editable
at once is not going to be very efficient, as it will require creating an actual component
for each cell that is currently painted by a renderer. As you noted, it is also more complicated
to do.

Note that double-clicking a row is not the only way to edit it - it is just the default. You
can programmatically edit a row based on other events. For example, you could have the up/down
arrow keys trigger an edit of the previous/next row. You also don't need to animate the transition
that opens and closes the editor. You could turn it off to improve efficiency if that makes
sense for your app.

> Just for your information, in JSF, I'm doing something like this:
> <h:dataTable value="#{orderBean.lines}" var="line">
>  <h:column>
>    <f:facet name="header"><h:outputText value="Item Name"/></f:facet>
>    <h:inputText id="itemName" value="#{line.itemName}" readonly="true"/>
>    <h:commandButton value="Search Item" onclick="..."/>
>  </h:column>
>  <h:column>
>    <f:facet name="header"><h:outputText value="Quantity"/></f:facet>
>    <h:inputText id="quantity" value="#{line.quantity}"/>
>  </h:column>
>  <h:column>
>    <f:facet name="header"><h:outputText value="Unit Price"/></f:facet>
>    <h:inputText id="unitPrice" value="#{line.unitPrice}"/>
>  </h:column>
>  <h:column>
>    <f:facet name="header"><h:outputText value="Delivery Date"/></f:facet>
>    <t:inputDate value="#{line.deliveryDate}"/>
>  </h:column>
>  <h:column>
>    <f:facet name="header"><h:outputText value="Cancel"/></f:facet>
>    <h:selectBooleanCheckbox value="#{line.cancelFlag}"/>
>  </h:column>
>  ..
> </h:dataTable>
> Above JSF code will render order lines in table rows, with Item Name,
> Quantity, Unit Price, Delivery Date and Cancel in columns, and all the
> rows show buttons, input fields and checkboxes.

You could potentially accomplish something like this by creating a custom, data-driven subclass
of TablePane. Rather than defining cell renderers, like TableView, it could allow the caller
to specify Components that would be used as the cell editors. It would automatically respond
to changes in the model by adding or removing rows.

This wouldn't be difficult to build. However, it doesn't seem like a very elegant solution
- it reminds me of an early HTML app, before DHTML/JavaScript. But that's just my opinion.


View raw message