Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82764

SearchPanes not refreshing when serverside is used.

$
0
0

Hi Allan,

I'm having problem with **searchpanes **not refreshing its content after ServerSide script has retruned new data.
I have a server-side DT with SearchPanes enabled for two columns. Server-Script returns data + searchPanes options for each Ajax call.

Search Pane config:

searchPanes : {
                initCollapsed   : true,  
                cascadePanes: false,
                dtOpts: {
                    select: {
                        style: 'multi'
                    }
                },
                columns       : [@string.Join(",", @header.FilterColumnIndexes)]
            }

Description of problem:
The initial draw correctly builds the SearchPanes + datatable using the returned JSON.
1. Subsequent draws returning updated (data + searchPanes.options) but the new searchPanes.options are not applied to the searchpane.

Initial draw1:

    {
        "draw": 1,
        "recordsTotal": 1328,
        "recordsFiltered": 0,
        "data": [
            ["Gas", "January"],
            ["Insurance", "January"]
            ...
        ],
        "error": null,
        "searchPanes": {
            "options": {
                "1": [
                        {"label": "Gas", "total": 10, "value": "Gas", "count": 10 }, 
                        {"label": "Insurance", "total": 10, "value": "Insurance", "count": 10 }
                ],
                "2": [
                        {"label": "January", "total": 10, "value": "January", "count": 10 }, 
                        {"label": "March", "total": 10, "value": "March", "count": 10 }
                ]
            }
        }
    }

draw2:

{
    "draw": 2,
    "recordsTotal": 1328,
    "recordsFiltered": 50,
    "data": [
        ["Gas", "January"],
        ["Insurance", "January"]
        ...
    ],
    "error": null,
    "searchPanes": {
        "options": {
            "1": [
                    {"label": "Gas", "total": 10, "value": "Gas", "count": 10 }, 
                    {"label": "Insurance", "total": 10, "value": "Insurance", "count": 10 }
            ],
            "2": [
                    {"label": "January", "total": 16, "value": "January", "count": 16 }
                              ... column 2 rows have reduced or data changed
            ]
        }
    }
}

After draw2 data received, i'm expecting the searchpanes.column2 to change but it's not changing.

  1. How can instruct SearchPanes to refresh the content once new JSON has arrived? () => $(tableSel).DataTable().searchPanes.rebuildPane() makes a new ajax call which I don't want.

  2. Is there any additional options that can be returned via JSON.searchPanes.options to customise | rebuild the searchPanes?. I.e. returning the searchPanes[field]: option(ajax). Which will help me to rebuild the searchPane with their selections.

Appreciate your help!.


Viewing all articles
Browse latest Browse all 82764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>