File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes sort dataTable & inputText Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "sort dataTable & inputText" Watch "sort dataTable & inputText" New topic
Author

sort dataTable & inputText

Tammy Easterby
Greenhorn

Joined: Jan 31, 2007
Posts: 28
Hi,

I've got a data table where you can sort by header. Inside the table the user can update a field on each record. Here's the problem: The sorting works if you're just going to sort, but not input any data. The input box works fine if you're not going to sort! If you try to sort AND input data - the input box only remembers which row number it was applied to, not the bean (data) within the row.

Has anyone out there successfully implemented anything like what I've described?

Thanks!
Marcel Frehner
Greenhorn

Joined: Nov 16, 2005
Posts: 3
I guess you've got to submit it first in order to update the backing bean for your table. Check whether the values you enter into your text fields get updated in the corresponding Bean. The sorting probably happens server-side, doesn't it?
Tammy Easterby
Greenhorn

Joined: Jan 31, 2007
Posts: 28
Yes, it is being submitted first. And the sorting does happen on the server side. When I check to see if the values entered into the text fields match the corresponding bean, I see that the values entered match the order of the beans that are initially displayed on the screen, not what is *actually* displayed on the screen. It shouldn't matter that the values entered in the box are maintained in memory, and not in the database, right? Or do I need to be running some kind of "update" method to "save" the screen in JSF?
Ravindra Rawat
Ranch Hand

Joined: Dec 09, 2004
Posts: 34
I hope i have understood the problem correctly. Assuming you are using myfaces impl.

My faces impl provided a "preserveDataModel" to control invocation of value binding for the component every time table is rendered.

Thanks
Ravindra S. Rawat
Tammy Easterby
Greenhorn

Joined: Jan 31, 2007
Posts: 28
Actually, I am using a plain old JSF dataTable. I am not familiar with MyFaces. My list of beans is somehow not linking up with the Data Graph... maybe. Not sure. Any further help would be greatly appreciated.
[ February 02, 2007: Message edited by: Tammy Easterby ]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: sort dataTable & inputText
 
Similar Threads
Searching an Array
adding a blank row to a JTable
Cell renderer for different JComboBox's in same column?
Auto Increment Row number
problem in adding a new row for the user input data