Server-Side Processing - sSearch = "null"

Server-Side Processing - sSearch = "null"

dlicorishdlicorish Posts: 7Questions: 0Answers: 0
edited August 2011 in Bug reports
The value passed server-side for the Search Box (sSearch) is not consistent. Initially, with no text in the Search field, sSearch is passed to the server as an empty string (""). However, if the box has been populated, then cleared, sSearch is passed as the string "null". Not sure if this is a bug or feature! ;-)

David

Replies

  • sebastienbelangersebastienbelanger Posts: 4Questions: 0Answers: 0
    Having the same behavior. Anyone else experienced this?

    Is there a work-around?
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    I can't replicate that issue using my server-side processing example: http://datatables.net/release-datatables/examples/data_sources/server_side.html . Can you link me to a page which does show the problem?

    Allan
  • sebastienbelangersebastienbelanger Posts: 4Questions: 0Answers: 0
    Oh sorry, didn't read properly the original post. Not using server-side processing on my page.

    Can't link to a page though as this is an internal app...
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    I've also just tried it on my client-side processing demos and it appears to work okay there. Can you use the debugger ( http://debug.datatables.net ) on your table when this problem occurs please?

    Allan
  • sebastienbelangersebastienbelanger Posts: 4Questions: 0Answers: 0
    Actually, if you try the example on this page:

    http://datatables.net/beta/1.9/examples/advanced_init/localstorage.html

    Try typing a value, then erasing it and refreshing the page. The box will be populated with "null"

    I actually just found a work-around by doing the following after the table init:

    if($("#example_filter input").val()=="null"){
    oTable.fnFilter( '' );
    }
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    What browser are you using where you see that? I've just tried Firefox and Safari (don't have IE to hand atm) and can't see that.

    Allan
  • sebastienbelangersebastienbelanger Posts: 4Questions: 0Answers: 0
    Having this behavior using IE8. Tried with the latest version of Firefox and don't have this behavior.
  • repairman2003repairman2003 Posts: 2Questions: 0Answers: 0
    Yes, IE8 passes on "null". I resolved this by forcing the page to load in IE 7 compatibility mode.
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Sorry I haven't had a chance to look at this yet - I've added this to my pre-1.9.1 list to make sure I do look at it before 1.9.1 is released (which will be next week now).

    Allan
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    This is possibly the most mental bug in IE I've ever come across! There is a blog post here from the IE team which describes the behaviour: http://blogs.msdn.com/b/jscript/archive/2009/06/23/serializing-the-value-of-empty-dom-elements-using-native-json-in-ie8.aspx .

    So the fix in DataTables is to cast the "empty string" to an empty string. Bonkers - but it works. Included in 1.9.1.

    Allan
This discussion has been closed.