dev@jsftemplating.java.net

Re: JSFTemplating: table sorting problem with dynamicTable

From: Karam Singh <Karam.Badesha_at_Sun.COM>
Date: Mon, 28 Jan 2008 15:52:57 -0800

Ken,
None of the request variables were used for the table data. Anyway, I
have gone ahead and changed all the attribute variables that were used
to pageSession variables and the result is still the same.

Did you ever write the test page (with dummy data) to test dynamicTable.
I think doing that test to see if the sorting works could be a good test.

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

thanks
Karam

Ken Paulsen wrote:
>
> Hi Karam,
>
> I tried the link you sent, but wasn't able to connect.
>
> Looking at this again, I can only think to say what I said last time
> re: request-scope. Did you try using pageSession / session to see if
> this changed things? Or did you try initPage? Even if the data
> appears to still be there after a refresh, that doesn't mean it didn't
> get populated via the restoreState call which always happens, but may
> happen after the table does its sorting (not sure... I don't know how
> Woodstock does this).
>
> Perhaps we can talk on the phone about this more later today (I'm on
> another call for the next 10-15 minutes).
>
> Ken
>
> Karam Singh Badesha wrote:
>> Ken,
>>
>> Any update. This is little urgent so if we could get the fix by the
>> end of this week it would be great.
>>
>> Also the updated link to see the app is now:
>> http://svl3.sfbay.sun.com:8080/CADRe-test/usageReport.jsf
>>
>> thanks
>> Karam
>>
>> Karam Singh wrote:
>>> 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
>>