How do you only rebuild the searchpane for the column you are editing?

How do you only rebuild the searchpane for the column you are editing?

pybcgpybcg Posts: 41Questions: 10Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: I am using the Editor and when I make an edit to a cell, I see that searchpanes gets rebuilt and it takes a very long time. How and where do I specify to rebuild? I know we're asked to do searchPanes.rebuildPane, but it's not clear WHEN you're supposed to run this. So far, I tried it at the Editor 'postEdit' event, but that's not working.

Answers

  • pybcgpybcg Posts: 41Questions: 10Answers: 0

    In the editor code, I noticed the following:

    dt.searchPanes.rebuildPane(undefined, true)

    This is a killer - I think this is redundant because I swear it's getting rebuilt somewhere else. I commented this out and now I'm good to go.

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Yep, if you're using Editor the panes will be rebuilt automatically - see example here - so you shouldn't need to do anything yourself.

    Colin

  • pybcgpybcg Posts: 41Questions: 10Answers: 0

    My questions were very confusing. Let me reask:

    You are correct in saying that the panes are being built automatically. unfortunately, i have tons of searchpanes and to refresh all searchpanes after each edit is very expensive. is there no way to turn this off? i had to comment out dt.searchPanes.rebuildPane(undefined, true) in the Editor code to prevent a global refresh, and I'm only rebuilding panes that are editor columns. I guess my question is why would EVERY searchpane get rebuilt when making edits? I have a table that has 5 editable columns and 20 uneditable columns and those uneditable columns should not have to rebuild.

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @pybcg ,

    Could you give me the line number for that call and I will take a closer look. A lot of the time the rebuilds are called to allow searchPanes.cascadePanes and searchPanes.viewTotal to operate. Are you using either of those? If not it may be possible for us to make an optimisation of some kind.

    Thanks,
    Sandy

  • pybcgpybcg Posts: 41Questions: 10Answers: 0

    // Rebuild searchpanes
    if ( typeof dt.searchPanes === 'function' && ! dt.settings()[0].oFeatures.bServerSide ) {
    // dt.searchPanes.rebuildPane(undefined, true)
    }

    See above for where I commented out "rebuildPane". I do indeed use cascadePanes, which I turned off and it actually really helps with performance. I might just keep it off.

    Secondly, jw if you guys see performance issues with these searchpanes? I have +15 columns with 7K rows and every edit makes the refresh searchPane take a long time. Are there any other suggestions to make it faster? Is the serverSide the only way?

  • pybcgpybcg Posts: 41Questions: 10Answers: 0

    Nevermind, I think I need to keep cascadePanes on.

    How come the refresh of searchPanes isn't simply asynchronous?

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @pybcg ,

    I can't find that line in the nightly version of SearchPanes. What line was it? It may be that we have made an improvement at some point that has removed this.

    searchPanes.cascadePanes does sometimes have an impact on performance with large datasets, but this can vary depending on a number of things. If you provide a link to your page or a test case showing the issue then I may be able to help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    I'm not sure what you mean by asynchronously refreshing? The panes need to refresh every time there is a selection, and when cascade is on that selection affects every other pane. This gets increasingly complex with further selections, making it impossible to refresh each pane asynchronously.

    Thanks,
    Sandy

This discussion has been closed.