No SearchPanes

No SearchPanes

TomCorrTomCorr Posts: 24Questions: 3Answers: 0

Hi, I initialized Search Panes and it just says "No SearchPanes",
is there a known reason for this??

Replies

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    Is there data in the Datatable when it is initialized? If the Datatable is initially empty then you will need to use searchPanes.rebuildPane() to rebuild the search panes after loading the data.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    In addition to what Kevin said, if the data is very unique, the default value for searchPanes.threshold may prevent the panes appearing. Try increasing the value towards 1 and see if that helps.

    Colin

  • TomCorrTomCorr Posts: 24Questions: 3Answers: 0

    Hi Kevin/Colin,
    Thanks for the quick feedback, I'm using MVC ASP.NET, I'm loading the datatable by sending a model to the view to populate the datatable, This is my JS:

    $(document).ready(function () {
        $('#example').DataTable({
            dom: 'Pfrtip',
            responsive: true,
        });
        $('#example').DataTable().searchPanes.rebuildPane();
    });
    

    But it still isn't loading the Panes.

    Where would i have to put the rebuidPane() function?

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954
    edited January 2020

    If you are loading the data after initialization the Datatable above then the rebuildPane() should follow immediately after to load the data into the table. If your table is sourced from the DOM then this is not the problem. In this case the problem is as Colin described and you will need to mess with the searchPanes.threshold option. Search Panes will create the panes if there is enough unique data.

    Also you might be interested in this section of the blog that describes Search Panes. Notice there is also a columns.searchPanes.show to force showing the search panes without the calculation.

    Kevin

  • TomCorrTomCorr Posts: 24Questions: 3Answers: 0

    Thanks Kevin/Colin,

    columns.searchPanes.Show did the trick for me, but when i want to clear filters it sends me this error in console:

        datatables.min.js:376 Uncaught TypeError: d._panes.adjust is not a function
            at v.action (datatables.min.js:376)
            at k (datatables.min.js:214)
            at HTMLButtonElement.<anonymous> (datatables.min.js:215)
            at HTMLButtonElement.dispatch (jquery-3.4.1.js:5237)
            at HTMLButtonElement.elemData.handle (jquery-3.4.1.js:5044)
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    That's been fixed, but not yet released. You can find the nightly releases here, it won't be happening there.

    Colin

  • TomCorrTomCorr Posts: 24Questions: 3Answers: 0

    Thank you both, great support.

This discussion has been closed.