user defined button

user defined button

MadMax76MadMax76 Posts: 122Questions: 26Answers: 0

I try to figure out how to create a button like this:

buttons: [
       { extend: 'selectedSingle',
         text: 'Kopieren',
             editor: editor,
         action: function ( data ) {
             ajax_call('__plugName__', 'kopieren', data.AR_Header.Re_Nummer_intern); }},
    ```
        
the column
{data: "AR_Header.Re_Nummer_intern"}, //4

```

does exist and works - but in the function I try to call there is no value showing. I also tried data.column(4) and other things, none worked....

Thanks
Max

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 13,786Questions: 25Answers: 3,242

    The buttons.buttons.action docs explain the parameters used for the custom button function. There is no data parameter passed. You will need to get the selected row via the API. See the docs for selectedSingle for how to get the row data.

    Kevin

  • MadMax76MadMax76 Posts: 122Questions: 26Answers: 0

    Hi Kevin,

    thanks, but none of the links (and some further search) provides an example of a single field to be read - all go for the whole row.

    Please...

    Thanks
    Max

  • colincolin Posts: 12,613Questions: 0Answers: 2,154
    edited September 7 Answer ✓

    You can use the selector-modifier value of {selected: true}, something like:

    action: function ( ) {
        let data = table.row({selected: true}).data();
        ajax_call('__plugName__', 'kopieren', data.AR_Header.Re_Nummer_intern); }},
    

    Colin

Sign In or Register to comment.