I am using the example "nested.html". I have a need to modify some Editor buttons: Can't find them.

I am using the example "nested.html". I have a need to modify some Editor buttons: Can't find them.

diidihammdiidihamm Posts: 12Questions: 4Answers: 0

I am using the example "nested.html". I have a need to modify the Editor buttons: Create, Update, and Delete codes to suit my application, but I can seem to find the code location. Please help.

Answers

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    right-click on the element and choose "inspect" to see the css being used. Change it or over-ride it to suit yourself.

  • colincolin Posts: 15,163Questions: 1Answers: 2,588

    When you say a need to modify the buttons, do you mean the styling (tangerine's comment above will help with that), or do you mean functionally?

    If you want to modify the functionality, this example may help. If not, please could you provide more information as it's not clear what your goal is.

    Colin

  • diidihammdiidihamm Posts: 12Questions: 4Answers: 0

    Tangerine and Collins, hi:

    Thanks for your prompt responses. By "modifying", I meant the functionality (ie: the code itself). Just for a background, I have left-joined two tables, one of which is a key/value type. Specifically, the tables are Wordpress' wp_users and wp_usermeta tables. When I edit a row, the data from the wp_users table is properly updated, but that from the wp_usermeta table ( a key/value structure) is not.

    I think I have an idea on how to get the wp_usermeta table updated also. I have to get to the code being executed by the "UPDATE" button in order to modify it to suit my purpose. However, I can't seem to get to it (the code).

    Any help is appreciated.

    Thanks

  • diidihammdiidihamm Posts: 12Questions: 4Answers: 0

    Sorry, Colin. I misspelt your name.

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    He doesn't mind - I've called him a lot worse ;)

    There is a lot of code that the buttons trigger - the button itself called the Editor edit() method for example. It goes all the way through the process for model display and inputs, then ultimately the submit() method is called to send the data to the server (this is all assuming you are using Editor btw?). The server-side script will then process the data, validate it and write it to the db. It sounds like the issue might be there? What script are you using for the server-side aspect here? Are you using the Editor PHP libraries?

    Allan

  • diidihammdiidihamm Posts: 12Questions: 4Answers: 0

    Allan, hi.
    1. Yes, I am using the Editor ( the example being used is "nested.html".
    2. I believe I am using the PHP libraries. I am invoking the html code from a Wordpress site.
    3. Yes. It is the final code call to the DB that I am interested in. I believe that to be able to update the key/value pair table (wp_usermeta), a second function has to be called after the initial call to the wp_users table.

    Thanks for your help.

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    Are you using the child table to update a single row in the wp_usermeta table? What PHP code are you using for that? Perhaps you can show me?

    Allan

  • diidihammdiidihamm Posts: 12Questions: 4Answers: 0

    Allan, hi:

    Sorry, I have been a little bit under the weather.

    Actually, the child table is the wp_usermeta table (the wp_users table being the parent table). I have been able to update it before in a non-datatable application with: ""UPDATE wp_usermeta SET meta_value = '$firstname' WHERE meta_key = 'first_name' and user_id = '$id'";

    However, in this DataTable application that I am working on, I am not using a PHP code; I just defined the table and the fields in the "JOINNESTED.PHP" and "NESTED.HTML" tables, and the code was handled by one of the "DATATABLE" javascript scripts.

    The problem is I can't find the "update" code in the script to modify it.

    Really appreciate your help on this.

    Thanks
    David

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    What does joinnested.php look like? Does it look something a bit like this?

    If so, that is the PHP libraries I publish for Editor. It will auto generate the SQL based on the configuration and the data submitted. I'd need to know what data you are submitting (i.e. the client-side configuration) and also the server-side code, to be able to say what is going on.

    Allan

  • diidihammdiidihamm Posts: 12Questions: 4Answers: 0

    Allan, hi:

    This are the contents of the joinNested.php file:

    <?php

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

    // 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;

    /*
    * Example PHP implementation used for the join.html example
    */
    Editor::inst( $db, 'wp_users' )
    ->field(
    Field::inst( 'wp_users.ID' )->set( false ),
    Field::inst( 'wp_users.user_login' ),
    Field::inst( 'wp_users.display_name' ),
    Field::inst( 'wp_users.user_email' ),
    Field::inst( 'a.meta_value' ),
    Field::inst( 'b.meta_value' ),
    Field::inst( 'c.meta_value' ),
    Field::inst( 'd.meta_value' ),
    Field::inst( 'e.meta_value' ),
    Field::inst( 'f.meta_value' ),
    Field::inst( 'g.meta_value' ),
    Field::inst( 'h.meta_value' ),
    Field::inst( 'i.meta_value' ),
    )
    ->LeftJoin('wp_usermeta as a', 'a.user_id = wp_users.ID') ->where('a.meta_key', 'first_name')
    ->LeftJoin('wp_usermeta as b', 'b.user_id = wp_users.ID') ->where('b.meta_key', 'last_name')
    ->LeftJoin('wp_usermeta as c', 'c.user_id = wp_users.ID') ->where('c.meta_key', '_streetAddress')
    ->LeftJoin('wp_usermeta as d', 'd.user_id = wp_users.ID') ->where('d.meta_key', '_city')
    ->LeftJoin('wp_usermeta as e', 'e.user_id = wp_users.ID') ->where('e.meta_key', '_state')
    ->LeftJoin('wp_usermeta as f', 'f.user_id = wp_users.ID') ->where('f.meta_key', '_zipCode')
    ->LeftJoin('wp_usermeta as g', 'g.user_id = wp_users.ID') ->where('g.meta_key', 'phone_number')
    ->LeftJoin('wp_usermeta as h', 'h.user_id = wp_users.ID') ->where('h.meta_key', '_dayMonthofBirth')
    ->LeftJoin('wp_usermeta as i', 'i.user_id = wp_users.ID') ->where('i.meta_key', '_datesAttendedFSSG')
    ->process($_POST)
    ->json();

    Thanks,
    David

Sign In or Register to comment.