bSearchable behavior intended? (server side data source)

bSearchable behavior intended? (server side data source)

knechtobotticknechtobottic Posts: 1Questions: 0Answers: 0
edited September 2013 in DataTables 1.9
Hello there,

i try to exclude a column from the global search filter by applying the "bSortable: false" attribute to it. The data field is correctly sent to the server side script, but it's ignored for the global search.

[code]$sWhere = "";
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    Not sure why its like that in the script you've got there, but its not the case in the main DataTables server-side processing script: https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/server_processing.php#L102

    Allan
  • knechtobotticknechtobottic Posts: 1Questions: 0Answers: 0
    Thanks for the fast response!

    Guess the datatables example site (http://datatables.net/examples/data_sources/server_side.html) needs to be updated :D

    BTW: I noticed some more bugs, like the whitespace in $aColumns not working as inteded.
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    I'm vaguely surprised that example is even there :-). The whole site is going to get an upgrade soon, so I'll make sure all the examples are up-to-date.

    Whitespace: good point - I've never used whitespace in my SQL column names myself, so I guess I just didn't take account of that when creating the script. As part of the upgrade, the PHP script needs a big upgrade (use PDO rather than mysql_*) so I'll look at that as well.

    Allan
  • knechtobotticknechtobottic Posts: 1Questions: 0Answers: 0
    Ah no no, I think whitespaces in column names should work fine. Im referring to this comment in your script:
    [code] /* Array of database columns which should be read and sent back to DataTables. Use a space where
    * you want to insert a non-database field (for example a counter or static image)
    */
    $aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );[/code]

    Anyways ... thanks for your help and keep up the good work!
This discussion has been closed.