SearchBuilder Never Refines The Table Data

SearchBuilder Never Refines The Table Data

pcnwebpcnweb Posts: 8Questions: 2Answers: 0

Link to test case:
https://pcnplus.org/dtest/dt_test.php

Debugger code (debug.datatables.net):
oyazih

Error messages shown:
None

Description of problem:
With the SearchBuilder plugin active, no matter what AJAX query it builds (which all seem correct in the Network console panel), it never filters the result set on the page - no errors in the console so I'm stuck on how to troubleshoot it? Does SearchBuilder not actually work for AJAX generated tables?

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Looks like we need to login to access the page. If you don't want to post the login info publicly then PM Allan directly with the info.

    If you have server side processing enabled (serverSide: true) the see the SearchPanes SSP docs.

    Kevin

  • pcnwebpcnweb Posts: 8Questions: 2Answers: 0

    I updated it to make it public. I'm sure I'm missing something from the docs you referenced, but I can't figure out what without any console error info.

  • pcnwebpcnweb Posts: 8Questions: 2Answers: 0
    edited December 17

    Attached my AJAX script (without db info) if that will help.

    <?php
     
    /*
     * DataTables example server-side processing script.
     *
     * Please note that this script is intentionally extremely simple to show how
     * server-side processing can be implemented, and probably shouldn't be used as
     * the basis for a large complex system. It is suitable for simple use cases as
     * for learning.
     *
     * See https://datatables.net/usage/server-side for full details on the server-
     * side processing requirements of DataTables.
     *
     * @license MIT - https://datatables.net/license_mit
     */
     
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Easy set variables
     */
     
    // DB table to use
    $table = 'thetable';
     
    // Table's primary key
    $primaryKey = 'id';
     
    // Array of database columns which should be read and sent back to DataTables.
    // The `db` parameter represents the column name in the database, while the `dt`
    // parameter represents the DataTables column identifier. In this case simple
    // indexes
    $columns = array(
        array( 'db' => 'name', 'dt' => 0 ),
        array( 'db' => 'description',  'dt' => 1 ),
        array( 'db' => 'bug',   'dt' => 2 ),
        array( 'db' => 'start_time',     'dt' => 3 ),
        array( 'db' => 'end_time',     'dt' => 4 ),
        array( 'db' => 'start_date',     'dt' => 5 ),
        array( 'db' => 'end_date',     'dt' => 6 ),
        array( 'db' => 'run_time',     'dt' => 7 ),
        array( 'db' => 'source',     'dt' => 8 ),
        array( 'db' => 'location',     'dt' => 9 ),
        array( 'db' => 'url',     'dt' => 10 ),
        array( 'db' => 'is_live',     'dt' => 11 ),
        array( 'db' => 'is_cc',     'dt' => 12 ),
        array( 'db' => 'is_new',     'dt' => 13 ),
        array( 'db' => 'is_pw',     'dt' => 14 ),
        array( 'db' => 'is_sh',     'dt' => 15 ),
        array( 'db' => 'year_prod',     'dt' => 16 ),
        array( 'db' => 'channel',     'dt' => 17 )
    );
     
    // SQL server connection information
    $sql_details = array(
        'user' => 'secret',
        'pass' => 'secret',
        'db'   => 'secret',
        'host' => 'localhost'
        // ,'charset' => 'utf8' // Depending on your PHP and MySQL config, you may need this
    );
     
     
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * If you just want to use the basic configuration for DataTables with PHP
     * server-side, there is no need to edit below this line.
     */
     
    require( 'ssp.class.php' );
     
    echo json_encode(
        SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
    );
    
  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    I don't believe the ssp.class.php supports SearchBuilder. My suggestion is to switch to use the Editor server side processing library. See this blog to learn how to use them.

    Kevin

  • pcnwebpcnweb Posts: 8Questions: 2Answers: 0

    Thanks, I'll read that.

Sign In or Register to comment.