Mike – do you know how to access the
source code for the java components for the examples (i.e., the source code for
the models/beans/controller components)? When I unzip the source code for the
examples, I get the .jsp page source, but only the .class (compiled) source for
the java components – I’d like to take a look at these source code
files as well to see how they are working (i.e., how they have coded the sort
method.)
I’ll keep you posted as to what I
find out / or if I can get this to work – sounds like we are both trying
to get the same functionality working.
Thanks.
From: Mike [mailto:[EMAIL PROTECTED]
Sent: Friday, December 30, 2005
6:03 PM
To: MyFaces Discussion
Subject: Re: Data Table Sorting
still not working
Hi Tom,
The way I understand it is that the sort() method gets called automatically
when you define your data table with an entry like this:
sortColumn="#{list.sort}"
(you have to have, in this case, a sort property with a getter/setter in
whatever class the list managed bean points to)
(per the sortTable.jsp example with the MyFaces source code).
So the list.sort, as I understand it, is the sort property in the list class
(or whatever class it really is based on faces-config).
Then, as I understand it, the <t:commandSortHeader...> will (somehow)
send the value (what you've defined in the columnName) into the list class (in
the above example and also magically call the sort() method based on the
sortColumn you defined.
This is the magical part that doesn't work for me at all.
So, I'm clearly not understanding ... SOMETHING!
I can match what I've done almost method for method, property to property, to
the "SimpleCarSort" in the example source.
Maybe I haven't configured something in faces-config.xml correctly -- maybe I
need another listener?
I really don't know.
Tomorrow I'm going to try to get the example one working from the source
locally (the car type/color) example. That may help validate I'm OK or there's
some wacky configuration problem.
Frustrating? Yup, I've spent two full days just trying to get the click of the
header to actually do something.
My URL also gets a "#" when I click the column appended to the end. I
have no idea what that signifies. But, if I manually remove it, I see that the
sort code runs but ALWAYS on the initial sort column -- nothing to do with me
clicking a particular colulmn.
My up arrow is always pointed down and it always stays on the first column even
when I click the second "sortable" column.
Also, my getSortColumn() never gets called.
I have a managed bean, but the posts talk about a "backing bean". I
think this is really the same, but, yet another question mark.
Sigh....
I'll write again tomorrow with my results from running, 'er, attempting to run,
the source example.
Write with any results you get too.
Mike
Tom Butler wrote:
Mike – are you calling the sort
method from within your getUpdates getter method in your bean (I’m
assuming Updates is your arraylist/datamodel since you have value
="#{TD.updates}" ?
Note I’m not sure if this is needed or not
– you are ahead of where I am with regards to getting this working
– I’m still working on understanding how to implement
this; The reason I’m asking about including the sort in the getter
method is because of a response I received from another mail list (mistakedly
sent this to the dev mail list earlier):
“-----Original Message-----
From: Thomas Spiegl [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 29, 2005 6:02 AM
To: MyFaces Development
Subject: Re: Tomahawk DataTable Sort Question - where/how is Sort Coded?
Sort your data in getArrlist_providers depending on
the values of
sortcol and sortascending.
Collections.sort(arrlist_providers, YourComparator)
may sort the list.
”
Also, here is another
example I just found that shows calling the sort within the getter
method:
http://mail-archives.apache.org/mod_mbox/myfaces-commits/200505.mbox/[EMAIL PROTECTED]
One good working example
end-to-end (complete code) would be very helpful. The link above is the
closet I have found, however, I’m still deciphering it – for
example, sort(getsortt(), getascending()) – I’m not sure what the
getsort() actually calls or resolves to?
Thanks
Tom
From: Mike [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 30, 2005
4:23 PM
To: MyFaces Discussion
Subject: Data Table Sorting still
not working
Hi Geeta ,
(Sorry I got your name wrong before....)
Below was a typo. Sorry. It should have been Persons, not getPersons.
I tried to replace TD with a longer name but that didn't help.
I'm baffled. The "hard" stuff, the programming, is so easy compared
to just "hooking up" the Data Table component. I've now spent another
day on this and have gotten nowhere.
For some reason, the commandSortHeader is just not working. I've also tried to
download a fresh "myfaces-all.jar" in case that was it. And, I've
tried to disable my firewall software. No dice. When I compare the sample to
what I have, they seem identically set up. Of course, I can't yet verify the
sample would run here either.
I suppose what I'll need to do is get the example installed an working. I'm
afraid that will be as difficult as what I'm facing now with all the config
file tweaks and such.
Thanks very much for your help!!!
Mike
[EMAIL PROTECTED] wrote:
Mike
<[EMAIL PROTECTED]>
wrote on 12/30/2005 12:36:39 PM:
> Hi Gretta!
>
> Thanks for your reply.
> Please see my comments in-line below....
>
> Mine is: value
="#{TD.getPersons}"
>
Shouldn't
you simply have "#{TD.persons}" ? Here's what i have:
<t:dataTable id="contactsearchdata" styleClass="scrollerTable"
headerClass="standardTable_BgWhiteHeader"
footerClass="standardTable_Header"
rowClasses="standardTable_Row1,standardTable_Row2"
columnClasses="standardTable_ColumnCentered,standardTable_Column,standardTable_Column,standardTable_ColumnCentered,standardTable_ColumnCentered,standardTable_ColumnCentered"
var="contact"
value="#{search.matchingContacts}"
rows="7"
rowId="#{contact.id}"
sortColumn="#{search.sort}"
sortAscending="#{search.ascending}"
preserveSort="true">
Also, if all
else fails, try replacing your name "TD" with something else. I
remember (though this was a long time ago!) short names which were capitalised
created trouble with reflection..
>
>
> Strange, huh?
>
> Mike
Regards,
Geeta
(..umm.. not "Gretta" ;))