When serverSide: true is enabled, it will cause my SearchBuilder advanced search to not work

When serverSide: true is enabled, it will cause my SearchBuilder advanced search to not work

lancwplancwp Posts: 90Questions: 20Answers: 1

Link to test case:
http://www.oceanshoes.com/temp/gborder.php
Debugger code (debug.datatables.net):
staff.php

include( "../lib/DataTables.php" );


// Web and thumbs paths to file
  $webPath = '/uploads/233.jpg';

// System paths
    $sysPath = $_SERVER['DOCUMENT_ROOT'] . $webPath;


// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;

// Build our Editor instance and process the data coming from _POST


Editor::inst( $db, 'ocorder' )

    ->fields(

        Field::inst( 'ocorder.id' )->set(false)  //ID是自新增的,加上set(false才能新增后自动刷新)
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'id is required' )   
            ) ),
        Field::inst( 'ocorder.factory' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( '大底工厂不能为空' ) 
            ) ),                        

        Field::inst( 'ocorder.ddbh' )
        ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( '大底编号不能为空' ) 
            ) )
        ,               
        Field::inst( 'ocorder.type1' )
                 ->setFormatter( Format::ifEmpty( null ) ),
        Field::inst( 'ocorder.size' ),          
        Field::inst( 'ocorder.sizediff' ),          

    Field::inst( 'ocorder.type2' )
            ->options( Options::inst()
                ->table( 'serviceshow4' )
                ->value( 'name' )
                ->label( 'name' )
            ),  

   Field::inst( 'ocorder.type3' ),
    Field::inst( 'serviceshow4.name2' ),




     Field::inst( 'ocorder.keyword' ),      
     Field::inst( 'ocorder.istax' ),
     Field::inst( 'ocorder.wear' ), 
     Field::inst( 'ocorder.bjbz' ),
     Field::inst( 'ocorder.bjstau' ),           


//    ->upload( Upload::inst('//10.0.8.7'.'/uploads/__ID__.__EXTN__' )              

    Field::inst( 'ocorder.hppic' )
     ->setFormatter( Format::ifEmpty( null ) )
    ->upload(
        Upload::inst( function ( $file, $id ) use ( $db ) {
        $extn = pathinfo( $file['name'], PATHINFO_EXTENSION ); // get extension
         $systempath=$_SERVER['DOCUMENT_ROOT'].'/uploads/'.$id.".".$extn;
         $sysPathThumbs1=$_SERVER['DOCUMENT_ROOT'].'/uploads/'.$id."_small".".".$extn;
         $webpath='/uploads/'.$id.".".$extn;  
         $webPathTumbs1='/uploads/'.$id."_small".".".$extn; 
        move_uploaded_file( $file['tmp_name'], $systempath);            
        createSmall($systempath);


       $db->update(
          'files',array(
          'web_path'    => $webpath,
           'webPathTumbs1'    => $webPathTumbs1,
          'system_path' => $systempath,
           'sysPathThumbs1' => $sysPathThumbs1
           ),
           array( 'ID' => $id )
           );
            return $id;
         } )

            ->db( 'files', 'id', array(
                'fileName' => Upload::DB_FILE_NAME,
                'fileSize' => Upload::DB_FILE_SIZE,
                'web_path' => '',
                'webPathTumbs1' => '',
                    'system_path' => '',
                    'sysPathThumbs1' => ''

                  ) )

/*      
         ->dbClean( function ( $data ) {
                // Remove the files from the file system
                for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
                    unlink( $data[$i]['system_path'] );
                }
             return true;
            } ) 

*/          
         ->validator( Validate::fileSize( 500000, '图片大小不能超过500K' ) )
                ->validator( Validate::fileExtensions( array( 'png', 'jpg', 'jpeg', 'gif' ), "Please upload an image" ) )   

          ),





            Field::inst( 'ocorder.hppic2' )
     ->setFormatter( Format::ifEmpty( null ) )
    ->upload(
        Upload::inst( function ( $file, $id ) use ( $db ) {
        $extn = pathinfo( $file['name'], PATHINFO_EXTENSION ); // get extension
         $systempath=$_SERVER['DOCUMENT_ROOT'].'/uploads/'.$id.".".$extn;
         $sysPathThumbs1=$_SERVER['DOCUMENT_ROOT'].'/uploads/'.$id."_small".".".$extn;
         $webpath='/uploads/'.$id.".".$extn;  
         $webPathTumbs1='/uploads/'.$id."_small".".".$extn; 
        move_uploaded_file( $file['tmp_name'], $systempath);            
        createSmall($systempath);


       $db->update(
          'files2',array(
          'web_path'    => $webpath,
           'webPathTumbs1'    => $webPathTumbs1,
          'system_path' => $systempath,
           'sysPathThumbs1' => $sysPathThumbs1
           ),
           array( 'ID' => $id )
           );
            return $id;
         } )

            ->db( 'files2', 'id', array(
                'fileName' => Upload::DB_FILE_NAME,
                'fileSize' => Upload::DB_FILE_SIZE,
                'web_path' => '',
                'webPathTumbs1' => '',
                    'system_path' => '',
                    'sysPathThumbs1' => ''

                  ) )
/*      
         ->dbClean( function ( $data ) {
                // Remove the files from the file system
                for ( $i=0, $ien=count($data) ; $i<$ien ; $i++ ) {
                    unlink( $data[$i]['system_path'] );
                }
             return true;
            } ) 
*/          

         ->validator( Validate::fileSize( 500000, '图片大小不能超过500K' ) )
                ->validator( Validate::fileExtensions( array( 'png', 'jpg', 'jpeg', 'gif' ), "Please upload an image" ) )   

          ),






        Field::inst( 'ocorder.content1' )
         ->setFormatter( Format::ifEmpty( null ) ),

        Field::inst( 'ocorder.removed_date' )
            ->setFormatter( Format::ifEmpty( null ) )

    )

->on( 'preCreate', function ( $editor, &$values ) {       
    //  $editor 
        //  ->field('sumpir1')
    //      ->setValue($values['pairs']*$values['pir1']); 


    } )

     ->on( 'preEdit', function ( $editor, $id, &$values ) {
/*
if ($values['cx']=='完成'){
                $editor
                    ->field('statu')
                    ->setValue ('完成');
                };
*/          

//      $editor
//          ->field('sumpir1')
//          ->setValue($values['pairs']*$values['pir1']);


    } )


    ->leftJoin( 'serviceshow4',   'ocorder.type2',   '=', 'serviceshow4.name' )
    ->where( 'ocorder.removed_date', null )
->on( 'preRemove', function () {
        // Disallow all delete actions since data cannot be removed completely
        return false;
    } )



//   ->leftJoin( 'serviceshow3', 'serviceshow3.name', '=', 'ocorder.brand' )
    ->debug(true)
    ->process( $_POST )
    ->json();

Error messages shown:

Description of problem:
The old problem has been bothering me because there are too many database records. When I enable serverSide: true on the server, the page becomes faster, but it will cause my SearchBuilder advanced search to not work. I don't know where the problem lies?

Answers

Sign In or Register to comment.