bStateSave not re-searching...

bStateSave not re-searching...

digitalfizdigitalfiz Posts: 3Questions: 0Answers: 0
edited June 2011 in Bug reports
I have bStateSave set to true and it saves the text that was searched in the searchbox but the search is not done on the table when the page is refreshed. I have to type in the box or remove text in the search box before is starts filtering again. Am I doing something wrong? Here is the code I am using:
[code]
$('.deviceTable').dataTable({
"aoColumns": [
/* Checkall */ null,
/* Name */ null,
/* Description */ { "bVisible": false },
/* tags */ { "bVisible": false },
/* Map */ null,
/* Last Seen */ null,
/* Actions */ null
],
"bSort": false,
"bStateSave": true
});
[/code]

Replies

  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Are you using 1.7.6? I think this is a bug which has been resolved in the 1.8 betas (when bSort is false - if sorting was enabled it would work). Could you grab the 'nightly' from the downloads page ( http://datatables.net/download ) and try that please?

    Thanks,
    Allan
  • digitalfizdigitalfiz Posts: 3Questions: 0Answers: 0
    I was using 1.8 and I just downloaded the latest and its still the same problem when bSort is false. It does work fine is bSort is true but my data doesn't need to be sorted just filtered and paginated
  • digitalfizdigitalfiz Posts: 3Questions: 0Answers: 0
    Never mind it was my bad I didn't update properly. Its working fine with the nightly
  • bidonbidon Posts: 28Questions: 0Answers: 0
    I have the same problem.
    With bSort : false, reloading the page correctly sets the filter text but the filtering is not done.
    No problem with bSort: true.
    Bug seen with datatables 1.8.1, 1.8.2 and 1.8.3.dev.

    By the way, thanks for this great program.
  • mikedmiked Posts: 43Questions: 3Answers: 0
    going to bump this thread vs opening a new one since it seems on topic, let me know if I should open a new one instead

    1.8.2 min version

    have column filtering in use with "bStateSave": true

    when the table reloads the column filtering is working and the data shown in the datatable reflects the filter that was last in use, and the result status correctly shows "Showing 0 to 0 of 0 entries (filtered from 3 total entries)"

    however the search input field that contains the value to filter on is blank which causes some confusion since it is unclear how there are 3 total entries yet 0 results and no filtering appears to be at play.

    not sure if this is a bug, or something that I need to handle on pageload
  • mikedmiked Posts: 43Questions: 3Answers: 0
    ok, doing some research on this on my end, if I look in the cookie I see a url encoded json string that decodes to:

    {"iCreate":1321554700688, "iStart":0, "iEnd":1, "iLength":10, "sFilter":"", "sFilterEsc":true, "aaSorting":[ [0, "desc"]], "aaSearchCols":[ ["", true], ["mi", true], ["", true], ["", true], ["", true], ["", true]], "abVisCols":[ true, true, true, true, true, true]}

    the aaSearchCols subarray contains my search string of "mi", now I need to trap for any value in aaSearchCols on page load and populate the value of the input field for any value present. Is there a JS snippet available that does this? Or a suggested methodology to add this in?

    bingo, search turns up the needed code here, 3rd post and 5th post: http://www.datatables.net/forums/discussion/992/solved-override-bstatesave-with-osearch-and-aosearchcols/p1

    I'm good to go I think
This discussion has been closed.