Option cascadePanes also breaks custom panes
Option cascadePanes also breaks custom panes
pgerundt
Posts: 90Questions: 13Answers: 2
in SearchPanes
Hi everyone,
Link to test case:
http://live.datatables.net/ruhuguwu/97/edit
Description of problem:
With cascadePanes: false
, everything works fine.
With cascadePanes: true
, a JS error occurs.
Error messages shown:
Uncaught TypeError: col is undefined
function _fnGetCellData( settings, rowIdx, colIdx, type )
{
if (type === 'search') {
type = 'filter';
}
else if (type === 'order') {
type = 'sort';
}
var draw = settings.iDraw;
var col = settings.aoColumns[colIdx]; <----- undefined!
var rowData = settings.aoData[rowIdx]._aData;
var defaultContent = col.sDefaultContent;
Replies
Thanks for the test case, that demonstrates it nicely - I'm seeing a different error, but yep, something wobbly there. I've raised it internally (DD-2464 for my reference) and we'll report back here when there's an update.
Cheers,
Colin
Hi @pgerundt ,
Thanks for pointing this out. That should be the issue fixed now as you can see at this example. This will be available in the next SearchPanes release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.
Thanks,
Sandy
Hi @sandy,
Thank you very much for the fix. You guys rock!
One last question: Is it possible to save the state of a custom pane?
If yes, it is not working anymore:
http://live.datatables.net/doligala/3/edit
Thanks!
Hi @pgerundt ,
I've just been looking at this as it's not something we have come across before. Sadly the answer is no. The states get saved as json, and since the custom panes use functions to perform the searching they cannot be saved to the state, and thus cannot be reselected.
I'm going to update the compatibility chart and make a note in the docs for this.
Thanks,
Sandy
Hi @sandy,
thanks for your time and efforts!
I modified the test case:
http://live.datatables.net/doligala/8/edit
If you are using SearchPanes 1.4.0 and disabling
cascadePanes
, the state gets saved correctly.So I guess it used to work magically, but somehow got corrupted in the nightly build.
Could you take another look, maybe you can get it working again...
Thanks,
Pascal
Hi @pgerundt ,
The nightly build for SearchPanes currently contains what will become SearchPanes v2.0.0. This is a complete rewrite of SearchPanes that should be less prone to bugs and much more maintainable in the long term. Part of the changes was to simplify the way that the selections were stored and remade, both for
searchPanes.cascadePanes
andstateSave
. The behaviour you are experiencing is an unfortunate knock on effect of this. But, it is a worthwhile trade off to reduce the complexity that caused far more bugs.You may be able to cobble something together using
stateSaveParams
andstateLoadParams
. You could replace the function with some kind of string instateSaveParams
which would allow the state to hold it. Then when it is loaded back in you could swap the string for the function again instateLoadParams
. Obviously this isn't something we can implement as a feature as the functions that people use are going to be totally different, but you may be able to get something to work.Thanks,
Sandy