dev@jsftemplating.java.net

table sorting problem with dynamicTable

From: Karam Singh Badesha <Karam.Badesha_at_Sun.COM>
Date: Wed, 23 Jan 2008 09:06:20 -0800

Hi Ken,
I am having sorting problems with the dynamic table. Here is my jsf code:

<sun:dynamicColumnRowGroup
                        id="rowGroup1"
                        data={"$attribute{usageSummaryDataList}"}
                        sourceVar="tRow"
                        styleClasses="rowColor1,rowColor2"
                        columnSort="$attribute{columnSorts}"
                        columnAlign="$attribute{columnAligns}"
                        columnHeaderText="$attribute{columnHeaders}"
                        columnFooterText="$attribute{columnHeaders}"
                        columnSpacerColumn="$attribute{columnSpacers}"
                        columnWidth="$attribute{columnWidths}"
                        columnValue="$attribute{columnValues}"
                        rows="#{pageSession.tableRows}"
>
        </sun:dynamicColumnRowGroup>

And here is the code snippet from the handler:

for (int i = 1; i <= count; i++) {
                String temp = "#{tRow.value.col" + i + "}";
                String temp2 = "col" + i;
                columnValues.add(temp);
                columnSorts.add(temp2);
                columnSpacers.add("#{false}");
                columnWidths.add(" ");
                if (i != 1) {
                    columnAligns.add("right");
                }
            }

This is exactly the same code if I would hardcode the tableColumn on the
jsf page (in terms of specifying sort and staticText value). With the
above code no matter what column I click on to sort, it always sorts the
entries in the first column. Please let me know if I am doing something
wrong or if there is a bug in the dynamic table code.

thanks
Karam