bug when use "fnStateSaveCallback" with ColReorder 1.0.4 and ColVis 1.06

bug when use "fnStateSaveCallback" with ColReorder 1.0.4 and ColVis 1.06

roychenroychen Posts: 5Questions: 0Answers: 0
edited December 2011 in Plug-ins
Hello,
I am try to enable the ColReorderWithResize plugin and the ColVis plugin for the datatable. All I want to do is
whenever the user change the visible column, order re-orders and resize a column, send this information to the server and re-use it when reloading the page , I already make the first step works, the columns can re-order also can visible or not visible, but when I try to use the "fnStateSaveCallback" save every change to server, my firebug tell me an error which is

"sCurrentVal is undefined
[Break On This Error] var sValue = sCurrentVal.split('"aaSorting"')[0]; "

I do not how to fix this problem, also I arleady try this

http://datatables.net/forums/discussion/6604/colreorder-1.0.4-will-nullify-user-specified-fnstatesavecallback/p1

but I still got same error, does anybody know how to fix this bug, please let me know. Thank you.

here is part of my javascript:

"fnStateSaveCallback": function ( oSettings, sValue ) {
sValue = '{ "key": "value", ' + sValue.substr(1);
oSettings = oTable.fnSettings();
var output = '';
for(var i = 0; i < oSettings.aoColumns.length; i++)
if(oSettings.aoColumns[i].bVisible)
{
output += "(" + oSettings.aoColumns[i].mDataProp + " " + oSettings.aoColumns[i].sWidth + "),";
}
alert(output);
}

also does anybody know how to get the new width for every cell after resize them, thank you


Roy

Replies

  • allanallan Posts: 61,435Questions: 1Answers: 10,049 Site admin
    Hi Ray,

    Please don't post the same question multiple times - I try to answer as many questions as possible, but flooding the forum doesn't help :-).

    To get the width of the cells you would need to use jQuery methods - something like $('#example thead th').each( function () { widths.push( $(this).width() } ); . The Resize plug-in doesn't fully integrate with DataTables' method for doing column sizing, hence why this is needed.

    Thanks,
    Allan
  • roychenroychen Posts: 5Questions: 0Answers: 0
    Allan, thank you to answer my question. Sorry to post same question multiple times on the forum. I will try your suggestion. Will the next version "ColReorderWithResize" plugin fix the fnStateSaveCallback bug, if yes, is it the new verson coming soon?



    Thanks,
    Roy
This discussion has been closed.