extra option button in Editor

extra option button in Editor

carlosavilescarlosaviles Posts: 21Questions: 0Answers: 0
edited March 2013 in Editor
I have a doubt about the use of admin premium templates that are using css for Editor. In these templates appears an extra option in the edit mode, for ex: approve, suspend, etc.. So I suppose that it´s possible to send extra information to the server with php and retrieve the data in this table and insert or edit the data in others tables too at same time. There is any example about this? What is the best way to do this?

Replies

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    If I understand correctly, you can have button specific submits like this:

    [code]
    "aButtons": [
    { "sExtends": "editor_create", "editor": editor },
    { "sExtends": "editor_edit", "editor": editor },
    {
    "sExtends": "editor_edit",
    "editor": editor,
    "sButtonText": "Approve",
    "fnClick": function ( button, config ) {
    var tt = this;
    var rows = tt.fnGetSelected();

    // use the Editor API to send an edit without showing the edit window
    editor.edit( rows[0], '', [], false );
    editor.set( 'status', 'approves' );
    editor.submit( function (json) {
    tt.fnSelectNone();
    } );
    }
    }
    ]
    [/code]

    Allan
  • carlosavilescarlosaviles Posts: 21Questions: 0Answers: 0
    edited March 2013
    Thanks Allan as always! ;-) It works now I can save this into the db, great! but what I have to do to send this item to antoher table at same time? Is the last question I have in this trial mode. I will recommend to my clients the use of Datatables in nexts projects strongly.

    I have noticed it only works for the first time. Cookies?
  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    > but what I have to do to send this item to antoher table at same time?

    Then you either need to make an another Ajax call to update the second table, or modify the server-side script that is processing the data to also update the second table.

    > I have noticed it only works for the first time. Cookies?

    I don't understand I'm afraid. It should work every time. I would need to see a test case to understand further.

    Allan
  • carlosavilescarlosaviles Posts: 21Questions: 0Answers: 0
    Hi Allan. I think this solution is a hard codding: I have to edit the editor code and the datatable code, and this is not easy, so I suppose is better the use of join tables.
    I have notice that the bug is because you have: editor.set this update the field but doesn´t insert anything. What do you think about?

    Thanks for your support this week. Best regards :-)
This discussion has been closed.