in IE6, changes to form data lost when paging
in IE6, changes to form data lost when paging
knodalyte
Posts: 3Questions: 0Answers: 0
Hi Allan,
I think I have posed this question to you before via email (forums are a great addition!).
I have a table that has a checkbox in the first column of each row, initially all are unchecked.
In IE6, any boxes that the user has checked on the form are cleared when paging forward and back.
This does not happen on IE7, IE8, or FF.
Is there any workaround? Any way I can patch DataTables code? BTW, this happens on 1.4.0, 1.4.3, and 1.5b6.
Thanks and regards,
Craig
I think I have posed this question to you before via email (forums are a great addition!).
I have a table that has a checkbox in the first column of each row, initially all are unchecked.
In IE6, any boxes that the user has checked on the form are cleared when paging forward and back.
This does not happen on IE7, IE8, or FF.
Is there any workaround? Any way I can patch DataTables code? BTW, this happens on 1.4.0, 1.4.3, and 1.5b6.
Thanks and regards,
Craig
This discussion has been closed.
Replies
Yes indeed I remember our conversation from before - it was your prompt that let me to add the fnGetHiddenNodes() plug-in API function. :-)
It sounds like a very odd situation that IE6 would uncheck radio boxes... This certainly shouldn't happen as the DOM is left untouched (and hence the radio buttons some be in the same state when shown again). I suppose it could be an IE6 bug, but it does seem odd. Do you have a link you could post with an example?
Thanks
Allan
The code that is giving me trouble is unreleased and will be on a secured application anyway. I will try to mock up similar code and put it somewhere public (this will also be a good check to make sure I'm not doing something else that causes this misbehavior).
I noticed the new fnGetHiddenNodes function but have found that the hidden nodes are also unchecked.
The partial workaround I have found thus far is to grab the content of each node from the oSettings.oaData.aData hierarchy (I'm working from memory here, hope I'm not too far off), do a string replace changing "hidden" to "checked", and then append the resulting element to the form. But I haven't yet worked out how to handle unchecking, I suspect this may break my workaround.
I will post another comment when I can make a working example available.
Regards,
Craig
https://dl.getdropbox.com/u/268678/dataTables-1.5/examples/basic_init/zero_config.html
It exhibits the same problem that I am seeing on my application under IE6, checkbox values do not persist when paging.
Note also that I made a mistake in my prior comment; I did not append the modified cell content (the input checkbox html) to the form, I do:
var oSettings = tabl.fnSettings();
var aoData = oSettings.aoData;
// ... looping through table rows ...
faData = aoData[j].dtData[0];
newfaData = faData.replace('disabled', 'checked');
tabl.fnUpdate( newfaData, j, 0, false );
Thanks very much for the demo - quite amazing. I've tried putting in a text box in place of the checkbox, and that works as you would expect. But the checkbox certainly does loose it's selected attribute.
What I think you will need to do to get around this, is to construct an array of 1's and 0's (which indicate checked or not) and apply an 'change' event handler to each select box. When it is checked (or unchecked) you can then update the array. Once you have this, you can make use of fnDrawCallback() to update the selected checkboxes on each draw.
Or you can call IE6 unsupported... :-(
Allan
Is there some news about this problem? A new solution with an example maybe ;)?
I'm afraid I'm not aware of any work that's been done on this - unless Craig as done some?
There really very weird - the elements are cached in Javascript memory, so for one of the attributes to be changed is crazy! But as I said in my last message, perhaps the only way around this with IE6 is to maintain a local array of what is going on with the checkbox state.
Regards,
Allan