ok, i'm not done yet, but it sounds like i'd better present it now.

i have been working on an editable table now for many weeks.  it supports
checkboxes and radio buttons as selection fields and supports sorting and
paging.  however, it is quite a bit of code (in displaytag, not for the end
user).

since editable tables met with a very cold response when i originally asked
about it, i tried to keep my stuff as isolated from the base displaytag code
as much as possible.  i had to modify the tabletag and columntag only (i had
to change a few other classes to make some private variables protected).  i
created two new packages, org.displaytag.editable and
org.displaytag.selectable and have extended many classes (thus the need for
protected access to certain variables).

the tag now looks like:
<display:table form="foo"...>
    <display:column select="true" selectAll="true" />
    ...
</display:table>

the form attribute tells the tag which form on the page to use for
submission.  it does not generate a <form> tag itself.  if you do not have
the form attribute, then the displaytag works exactly as it always has, and
none of my code will ever get fired.

however, adding the form attibute will make each Row object a SelectableRow,
the select column a SelectableColumn, the SelectableColumn uses a
SelectableColumnIterator, etc.  it is quite abstracted from the base code.

to make it work, if you add the form attribute, i also add two javascript
functions (one has 2 lines, one has 4 lines).  so, if javascript is turned
off, the selection capabilities do not work.  most users have javascript
enabled since much on the web does not work without javascript.  i have
confirmed that all the javascript is compatible from IE3.0 and NS2.02 and
up.

the selectAll attribute in the column tag tells the displaytag to put the
checkbox in the titlebar to select/deselect all.  this has the effect of
selecting or deselecting all on all pages of a paginated list.  if set to
false, nothing is displayed in the title.  you cannot sort the selection
column.

there is a utility class that the user calls methods on to get the selected
rows.  the utility class will return a int[] of all the row positions of the
original list that were selected from the displaytag, regardless of
pagination or sorting while using the list.

the performance hit is nominal.  a 10,000 row list, displaying 10 items per
page, adds a 250ms hit for selectability.  a 100 row list adds <20 ms.

i can send you the code and a compiled jar if you'd like.  i am using 1.0b2
as my base.

it is not flawless yet.  everything works fine except odd combinations like
selecting all, then deselecting some items, then submitting the page, then
pressing the back button.

thanks,
steve

----- Original Message ----- 
From: "Matt Raible" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 11, 2004 11:51 PM
Subject: [displaytag-devel] Editable Table Implementation


> I spent a couple of hours tonight and threw together an editable table
> implementation - with the existing library.  It uses a lot of JSTL and
> <c:if> statements - it's not super clean, but it does work.  No
> feedback is necessary - but thoughts are appreciated.  I imagine I'd
> get more feedback from the user list, but I thought I'd pass it by you
> guys first.
>
> http://demo.raibledesigns.com/appfuse/users-edit.jsp
> http://demo.raibledesigns.com/appfuse/users-edit-sql.jsp
>
> Matt
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> displaytag-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-devel
>



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to