| Page 1 of 1 | [ 10 posts ] |
|
Hi,
I have a YUI datatable of multiple pages using paginator. I can retain the status of checkbox in all pages. But I am not able to retain the value of a text input field in all pages. E.g - in one page I am inserting some value into text input field and I move to other pages. Then when I again come back to that page, the input field value is auto reset to the loading time. Is there any way to handle that, even the input field object is also coming null for other pages. my requirement: I will insert value to one input field in page 3 and in page 1 onclicking of submit button I should get the text inserted in page 3. Thanks in advance. |
|
When you paginate the DOM is destroyed and replaced, so the input field is gone. If you want to save the value, you have to catch the event from Paginator and save the value from the field.
|
|
I assume you are not using the built-in editor because if you did, the value would be preserved for you. As John has said, the DOM is destroyed on pagination because the DOM is just a reflection of what the DataTable stores internally in the RecordSet. The DOM is volatile, the RecordSet remains. What I disagree with John is that the field in the Record instance for the edited row has to be kept in synch at all times. The DOM is not only destroyed with pagination, sorting on a column will also destroy it and a few other actions also will so the rule is, as soon as something is updated, it should be reflected in the RecordSet, then whatever happens, it will be preserved and refreshed when paging through, sorting by column or whatever.
|
|
Good point. If you allow sorting, then that also destroys the DOM, so the best solution is to use a cell editor.
|
|
Thanks for your suggestions John, Satyam.
I understood that the dom object gets reset in each page and its client level. RecordSet once fetched remains. Got the cell edit feature of datatable. Thanks. So basically it seems like we can't work on input fields with paginator or is there any way? |
|
Yes you can use all sorts of controls in cells:
http://www.satyam.com.ar/yui/2.6.0/asso ... trols.html |
|
But the state of those controls will not be persisted when you paginate or sort, unless you save the values yourself.
For example, QuickEdit (http://jafl.github.com/yui2/quickedit/) shows input fields in all the table cells, but it disables pagination, because you have to save before doing anything else. |
|
The whole point of the example is to show how to save the values of each control, not just how to show them.
|
|
I built a YUI 3 Gallery module for saving state in a DataTable. It supports both form fields and widgets. It maintains the state, so you can save it when you want to. You are not forced to save it immediately.
http://yuilibrary.com/gallery/show/datatable-state |
|
I just realized that another option is to use gallery-bulkedit (http://yuilibrary.com/gallery/show/bulkedit). The examples show fields in all columns, but you could show read-only values in some columns, if you want.
|
| Page 1 of 1 | [ 10 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group