You can also set the table as sorted so it does not attempt to sort the column.
regards Malcolm Edgar On Thu, Jul 16, 2009 at 6:57 PM, Bob Schellink<[email protected]> wrote: > Hi Jeff, > > The demo uses a trick to make the List size bigger than what it really > is. This breaks the List contract though so not all List methods work > as expected. Sorting is one of them. > > The real issue is that Table should not attempt to sort the list > because it does not have access to all the rows. > > Since you are lazily loading the rows for the specified page you are > also responsible to ensure the data is sorted, most probably using an > SQL ORDER BY clause. > > To get around the fact that Table tries to sort the rows you can do this: > > public void onInit() { > Table table = new Table() { > > // Override sortRowList to do nothing > protected void sortRowList() { > } > } > } > > Will this work for you? > > We should probably look at ways to make this setup easier in a future release. > > kind regards > > bob > > On 7/15/09, ljnb01 <[email protected]> wrote: >> >> Hi, >> >> I am using Click Framework deployed in Glassfish. I followed the example in >> click-examples's Large Dataset Demo, but used FormTable. >> >> All works OK but only if I sort the column or sometimes click next page I >> got an exception. The "Large Dataset demo" did not show a FormTable with >> sorting features, it is simple of "table type without sorting enabled. >> >> So how can I fix this bug in a large dataset FormTable with sorting enabled? >> Or can it be done? Any examples? I thought this is very common for many >> commercial apps but did not find any examples. Thanks. >> >> ----- Error messages ----------- >> >> [#|2009-07-15T16:59:06.602-0400|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=26;_ThreadName=httpSSLWorkerThread-80-0;_RequestID=39cb07ae-3250-4192-b8f2-9f4cdbc95729;|ApplicationDispatcher[/osbmui] >> PWC1231: Servlet.service() for servlet jsp threw exception >> java.util.NoSuchElementException >> at java.util.AbstractList$Itr.next(AbstractList.java:350) >> at java.util.Collections.sort(Collections.java:162) >> at org.apache.click.control.Table.sortRowList(Table.java:1778) >> at org.apache.click.control.Table.render(Table.java:1344) >> at >> org.apache.click.extras.control.FormTable.render(FormTable.java:605) >> at >> org.apache.click.control.AbstractControl.toString(AbstractControl.java:833) >> at com.sun.el.lang.ELSupport.coerceToString(ELSupport.java:341) >> at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:351) >> at >> com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:209) >> >> >> >> ----- >> http://blogs.dengsoft.com/index.php/tech/ Java Technology Blog >> -- >> View this message in context: >> http://n2.nabble.com/java.util.NoSuchElementException-when-using-FormTable-Sort-tp3265887p3265887.html >> Sent from the click-user mailing list archive at Nabble.com. >> > > > -- > http://incubator.apache.org/click/ >
