1.10 sortable = false with server-side script causing ssp.class.php syntax error #261

morrow95 opened this Issue Jan 5, 2014 · 1 comment


None yet

2 participants

morrow95 commented Jan 5, 2014

Using the following to set my first column to render a checkbox and not searchable / not sortable by the user. I found that "sortable": false, would throw an error in ssp.class.php's sql syntax for returning data.

If I add "aaSorting": [], to the statement below the error would go away. This is not the expected behavior as the latter should not be needed.

"columnDefs": [
        "targets": [ 0 ],
        "searchable": false,
        "sortable": false,
        "render": function ( data, type, row ) {
            return '<input type="checkbox" class="checkboxes" value="'+data+'" />';

I believe I found the problem in ssp.class.php's order function...

    static function order ( $request, $columns )
        $order = '';

        if ( isset($request['order']) && count($request['order']) ) {
            $orderBy = array();
            $dtColumns = SSP::pluck( $columns, 'dt' );

            for ( $i=0, $ien=count($request['order']) ; $i<$ien ; $i++ ) {
                // Convert the column index into the column data property
                $columnIdx = intval($request['order'][$i]['column']);
                $requestColumn = $request['columns'][$columnIdx];

                $columnIdx = array_search( $requestColumn['data'], $dtColumns );
                $column = $columns[ $columnIdx ];

                if ( $requestColumn['orderable'] == 'true' ) {
                    $dir = $request['order'][$i]['dir'] === 'asc' ?
                        'ASC' :

                    $orderBy[] = '`'.$column['db'].'` '.$dir;

            $order = 'ORDER BY '.implode(', ', $orderBy);

        return $order;

should be if ( $requestColumn['orderable'] == true ) { as it should be a Boolean and not a string.

Please review the above, but from what I can tell I believe this was the problem in my situation.


Hi - just a quick note to say I haven't forgotten about this! I'm still debating with myself what the best course of action is. the sortable flag in DataTables I've been treating as having an effect on the user ability to sort only (i.e. the API can be used to sort columns that are marked as sortable: false.

If that holds true, then the server shouldn't check for sortable at all and DataTables shouldn't bother sending it either...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment