dev@jsftemplating.java.net

Re: JSFTemplating: Table Sorting problem

From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Sat, 20 Jan 2007 13:51:30 -0800

Hi Karam,

We have many exampls in Glassfish Admin Console that does sorting in a table.  You can look at any of the jsf file that has <sun:table> components.

Just a quick concrete example:  under src/docroot/resources/poolTable.inc

 <sun:tableRowGroup id="rowGroup1" selected="#{td.value.selected}" data={"$attribute{listOfRows}"} sourceVar="td">
 ...
 ...
 <sun:tableColumn headerText="#{resHeader}"  sort="resInfo" rowHeader="$boolean{true}" id="col2">
        <staticText id="resCol" value="#{td.value.resInfo}" />
    </sun:tableColumn>

    <sun:tableColumn headerText="#{extraInfoHeader}" sort="extraInfo" rowHeader="$boolean{true}" id="coltype">
        <staticText id="extraCol" value="#{td.value.extraInfo}" />
    </sun:tableColumn>


To get more advance sorting,  you may want to look at the attribute "sortPanelToggleButton"  in the  table component. 

Hope this help.

Anissa


Karam Singh Badesha wrote:
Hi,
Table data variable is set as a pageSession in my code. When I click on any column header to do the sort, all my content disappears and I get an empty table. Please let me know what am I doing wrong. My first column is of type String and other two are integers.
Can someone please explain the "sort" option of the table with some examples(example where content is of mixed types). Not knowing the proper use, I just used the following for my columns looking at the examples provided by woodstock.
                       sort="first"
                       sort="second"
                       sort="last"

Now if I change that to say (not sure what this is doing):
                       sort="#{1}"
                       sort="#{2}"
                       sort="#{3}"
Now the data doesn't disappear when I click for sort and I am able to do multiple sort by clicking of +  but the data is not sorted. So I am pretty sure the problem is with the sort definition in my code. Please help.

thanks
Karam