dev@jsftemplating.java.net

Re: JSFTemplating: table sorting problem with dynamicTable

From: Karam Singh <Karam.Badesha_at_Sun.COM>
Date: Thu, 24 Jan 2008 12:12:02 -0800

Ken,
The data is still there if even clicking on sort was doing page refresh.
Here is the url of the actual page:

http://svl1.sfbay.sun.com:8080/CADRe-test/usageReport.jsf

If you click on sort for any column except first one, you will see that
it always sort just the first column. Please help.

thanks
Karam

Ken Paulsen wrote:
>
> Hi Karam,
>
> Sorry it took me so long to respond. I looked at your code... and
> from just looking at it, I don't see anything that jumps out as being
> incorrect.
>
> Hmm... actually looking at your page again, I see you're using a
> beforeCreate event. This event is triggered before something is
> created (as the name suggests). On a page refresh (as done when you
> click a sort link), it won't re-execute anything. While you are
> storing a lot in pageSession, you are storing some things in request
> attributes. The request attributes will not be available when the
> page is resubmitted. Perhaps the code handling the sort needs access
> to that information again? I'm not sure that is the case, but you
> might try changing to pageSession to see if that fixes it. Or use the
> initPage event (must go at the top of the page) for this handler.
>
> If that doesn't help, we'll have to look more closely at what is
> happening when the sort link is clicked to see why it's not working.
>
> Ken
>
> Karam Singh wrote:
>> Ken,
>> Were you able to figure out the problem?
>>
>> thanks
>> Karam
>>
>> Ken Paulsen wrote:
>>>
>>> Hi Karam,
>>>
>>> I think it would help me to see more context. Can you provide the
>>> complete .jsf source and the full handler methods?
>>>
>>> Thanks!
>>>
>>> Ken
>>>
>>> Karam Singh Badesha wrote:
>>>> 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