[php] join in server side

[php] join in server side

scipiosoftscipiosoft Posts: 18Questions: 8Answers: 0
edited May 2016 in Editor

serverside dont work with prefix or join..

example:

<?php
        $editor = Editor::inst( $db, '[dbo].[translations] as def')
        ->pkey('def.id') // set primary key
        ->idPrefix('') // set prefix id
        ->fields(
                Field::inst( 'def.id' ),
                Field::inst( 'def.product' ),
                Field::inst( 'def.brand' ),
                Field::inst( 'def.t_key' ),
                Field::inst( 'def.description' ),
                Field::inst( 'def.modify_by' ),
                Field::inst( 'def.date_created' )
                    ->validator( 'Validate::dateFormat', array(
                            "format"  => Format::DATE_TIMESTAMP,
                            "message" => "Please enter a date in the format yyyy-mm-dd"
                    ) )
                    ->getFormatter( function ( $val, $data, $opts ) {
                        $val = floor($val/1000);
                        $dt = new DateTime("@$val");  // convert UNIX timestamp to PHP DateTime
                        $dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
                        return $dt->format('Y-m-d H:i:s'); // output = 2012-08-15 00:00:00
                    } )
                ) ;

        $out = $editor->process( $_POST )->data();
        
        // On 'read'
        // option works on the client-side.
        if ( Editor::action( $_POST ) === Editor::ACTION_READ ) {

            for ( $i=0, $ien=count($out['data']) ; $i<$ien ; $i++ ) {
                // processing data ($out)
            }
        }

        echo json_encode($out);
?>

have some idea?

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    Can you clarify in what way it doesn't work? Do you get an error message, and if so, what is that error message?

    Allan

  • scipiosoftscipiosoft Posts: 18Questions: 8Answers: 0

    this is work ... but i need this in serverside

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin
    Answer ✓

    I'm afraid I still don't understand. To enable server-side processing with the Editor libraries you simply enable serverSide and have DataTables send the request as a POST. Example.

    If that isn't working for you, what errors do you see?

    Allan

This discussion has been closed.