Hi Karam,
Yes I did write a test page, which I sent to you when I first created
the dynamic table factory. I modified this test page to ensure sorting
works as expected. In my test case, it does work. Here is the page:
<!initPage
######################
## CREATE DATA ##
######################
// Row 1
createMap(result=>$attribute{row1});
mapPut(map="$attribute{row1}" key="a" value="Ken");
mapPut(map="$attribute{row1}" key="b" value="A");
mapPut(map="$attribute{row1}" key="c" value="Paulsen");
// Row 2
createMap(result=>$attribute{row2});
mapPut(map="$attribute{row2}" key="a" value="Jaye");
mapPut(map="$attribute{row2}" key="b" value="L");
mapPut(map="$attribute{row2}" key="c" value="Jurhs");
// Row 3
createMap(result=>$attribute{row3});
mapPut(map="$attribute{row3}" key="a" value="Mike");
mapPut(map="$attribute{row3}" key="b" value="C");
mapPut(map="$attribute{row3}" key="c" value="Doe");
// Create List of Map (List of the rows)
setAttribute(key='listOfRows' value={"$attribute{row1}" "${row2}"
"${row3}"} );
/>
<sun:page>
<sun:html>
<sun:head id="head" />
<sun:body>
<sun:form id="form">
<sun:table id="basicTable" title="Basic Table">
<sun:dynamicColumnRowGroup id="rowGroup1"
data={"$attribute{listOfRows}"} sourceVar="td" columnHeaderText={"Col
1", "Col 2", "Col 3"} columnValue={"#{td.value.a}", "#{td.value.b}",
"#{td.value.c}"} columnSort={"a", "b", "c"}>
</sun:dynamicColumnRowGroup>
</sun:table>
</sun:form>
</sun:body>
</sun:html>
</sun:page>
I think the main thing to ensure for the Woodstock Table's sorting is
the column sorting key. Make sure that is correct and it should work.
Also the data that you are sorting must be available when the Woodstock
table performs its sorting.
I'm not a table expert, though... so if the above doesn't help, we'll
probably need to invite Dan L. to the conversation (or just post to the
dev_at_woodstock alias). The part where JSFT is involved is strictly in
creating the proper UIComponents and setting their properties (which are
just passed through from whatever you set). You can see this is
happening in the above case. I can see it's not working on the url you
sent, but I don't see why from the code you provided. Your handler code
seems to be providing a list equivalent to the {"a", "b", "c"} one I
provided above, yet it doesn't work.
The only notable thing I see different is that I initialize the data in
initPage. If you are initializing it too late, it might not sort at
all, or perform some default sort (Dan might be able to answer this).
Suggestions to try... mock up your data like I did above, see if that
fixes it. If yes, debug your data to ensure it is correctly available
at all times and that its context is complete and correct. If no, look
at the how you're declaring your component, make sure keys are matching
up correctly with your data, and continue to debug the component
itself. Are the values in the columns Strings? If not, do they have
correct equals() methods?
Sorry I'm not being more help... but I'm fishing for the answer.
Ken
Karam Singh wrote:
> 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
>>>