user defined button

user defined button

MadMax76MadMax76 Posts: 149Questions: 33Answers: 1

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: 20,425Questions: 26Answers: 4,794

    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: 149Questions: 33Answers: 1

    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: 15,177Questions: 1Answers: 2,590
    edited September 2021 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.