Where using Editor

Where using Editor

blaxusblaxus Posts: 7Questions: 0Answers: 0
edited August 2012 in Editor
Hey, I got the Datatables editor working for me but I want to edit my "pages" table, however some pages belong to a specific project, ie. WHERE pid = project.

But I can't for the life get the datatables editor to work with a where like this. Anyone who can help me out?

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Hi blaxus,

    This is a good point - there isn't currently a public API for the Editor class which will add a WHERE condition to the table automatically (I will ensure that this is done in the next version). However, it is relatively easy to modify the PHP code to add your WHERE condition.

    If you look in the Editor.php class, you will find the following block in the `private _get` method:

    [code]
    if ( $id !== null ) {
    $query->where( $this->_pkey, $id );
    }
    [/code]

    That's where Editor adds its own WHERE condition, and also where you can add your own. For example you might have:

    [code]
    if ( $id !== null ) {
    $query->where( $this->_pkey, $id );
    }
    $query->where( "mgt_group", "DataTables" );
    [/code]

    The database class will automatically AND those together :-).

    Regards,
    Allan
This discussion has been closed.