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

Nightly build does not store "special" selected filters via stateSaveCallback

$
0
0

There is a bug in the nightly build of searchPanes - it works with the previous releases. Once again, I cannot provide a test case because there is no working ajax endpoint for retreiving data unter live.datatables.net.

Imagine having a simple table with one column ("location"), displaying the human-readable location name in the table and providing a searchPane with human-readable label but the database id as value.

Your ajax call would return something like:

{
  draw: 1,
  ...
  data: [
    {
      location: 'Munich'
    },
  ...
  searchPanes: {
    options: {
      location: [
        {
          label: 'Munich',
          value: "42",             <---- here is the problem
          count: 1,
          total: 1
        }
        ...
    }
  }
}

When selecting this filter the stateSaveCallback is triggered and data contains the selected filter. Perfect.

But if you reload the page, stateSaveCallback: function(settings, data) is triggered once again but the data does not contain the selected filter anymore:

{
  searchPanes: {
    panes: [
      {
        ...
        selected: []             <---- here is the bug
      }
    ]
  }
}

This only occurs if your searchPanes option (see above) has a different value from the label. If you set the value to "Munich", everything works fine.

Even when storing the state in the dom (without stateSaveCallback), this does not work.


Viewing all articles
Browse latest Browse all 82388

Trending Articles



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