query in tabletools

query in tabletools

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2
edited December 2014 in TableTools

Hello , I need to make a query using tools TableTools , but in the examples the construction of query qun is not displayed. How I can make one using as an example the following?

<script>
include( "../../php/DataTables.php" );
 
// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Join,
    DataTables\Editor\Validate;
 
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'datatables_demo' )
    ->fields(
        Field::inst( 'first_name' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'last_name' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'position' ),
        Field::inst( 'email' ),
        Field::inst( 'office' ),
        Field::inst( 'extn' )->validator( 'Validate::numeric' ),
        Field::inst( 'age' )->validator( 'Validate::numeric' ),
        Field::inst( 'salary' )->validator( 'Validate::numeric' ),
        Field::inst( 'start_date' )
            ->validator( 'Validate::dateFormat', array(
                "format"  => Format::DATE_ISO_8601,
                "message" => "Please enter a date in the format yyyy-mm-dd"
            ) )
            ->getFormatter( 'Format::date_sql_to_format', Format::DATE_ISO_8601 )
            ->setFormatter( 'Format::date_format_to_sql', Format::DATE_ISO_8601 )
    )
    ->process( $_POST )
    ->json();
</script>

Answers

This discussion has been closed.