Option cascadePanes also breaks custom panes

Option cascadePanes also breaks custom panes

pgerundtpgerundt Posts: 90Questions: 13Answers: 2

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

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    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

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    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!

  • sandysandy Posts: 913Questions: 0Answers: 236

    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

  • pgerundtpgerundt Posts: 90Questions: 13Answers: 2

    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

  • sandysandy Posts: 913Questions: 0Answers: 236

    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 and stateSave. 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 and stateLoadParams. You could replace the function with some kind of string in stateSaveParams which would allow the state to hold it. Then when it is loaded back in you could swap the string for the function again in stateLoadParams. 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

Sign In or Register to comment.