[SOLVED] Search (Filter) not working

[SOLVED] Search (Filter) not working

MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
edited March 2011 in General
I am using server-side processing and when I try to use the search, it returns the "JSON cannot be parsed" error.
Not sure why this is happening.

Can anyone help out? What code do I need to post?

Replies

  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    edited March 2011
    Ok, narrowed it down to the SQL on the server-side.
    However, it seems to be filtering wrong.

    Since the DataTable that I'm using is "dynamic", meaning depending upon what param I pass to the page it wil have a different number of columns, and, even though the columns may differ, I have been able to use the aoColumns variable to define it but the WHERE is being built with all columns, not just the ones where bSearchable is set to true.
    [code]
    [bRegex] => false
    [sSearch_0] =>
    [bRegex_0] => false
    [bSearchable_0] => true
    [sSearch_1] =>
    [bRegex_1] => false
    [bSearchable_1] => true
    [sSearch_2] =>
    [bRegex_2] => false
    [bSearchable_2] => true
    [/code]

    Even though it has aoColumns defined like this:
    [code]
    "aoColumns": [{ "bSearchable": true },
    null,
    { "bSearchable": true }],
    [/code]
  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    Ok, looks like I finally figure this out. I had to set bSearchable to false on the columns I didn't want for it to work correctly.

    How would I clear sSearch when the table is first built?
    If I click on a link to another page that has the same table, the search value is persistent and it filters the values in the table when it loads.
  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    This is how it looks now:
    [code]
    "aoColumns": [{ "bSearchable": true },
    { "bSearchable": false },
    { "bSearchable": true }],
    [/code]
  • MrBaseball34MrBaseball34 Posts: 96Questions: 0Answers: 0
    Hey, I just remembered that I had bStateSave set to true. Set it to false and all works well.
  • axllaruseaxllaruse Posts: 8Questions: 0Answers: 0
    It doesn't work for me.
    For some reason, if there are many columns of different types, the search goes on "Processing..." without explaining why is failing
This discussion has been closed.