Does Datatables' natural sort plugin work where data is got with server side processing?

后端 未结 2 908
礼貌的吻别
礼貌的吻别 2021-01-25 22:10

I got it to work with static html data as shown in this jsfiddle:

http://jsfiddle.net/L7PNV/

by specifying

aoColumns: {\"sType\": \"natural\"}
<         


        
2条回答
  •  甜味超标
    2021-01-25 22:48

    Just modify the 'static function order ( $request, $columns )' function in 'ssp.class.php':

    if ( $column['db'] == 'Nr' ) {
        // Natural Sort
        $orderBy[] = 'LENGTH(`' . $column['db'] . '`) ' . $dir . ', ' . '`' . $column['db'] . '` ' . $dir;
    } else {
        $orderBy[] = '`' . $column['db'] . '` ' . $dir;
    }
    

    From now on the column with the name 'Nr' will have natural sort.

提交回复
热议问题