Definable button on a row ?

Definable button on a row ?

supportNEsupportNE Posts: 23Questions: 7Answers: 0

Thanks to Allan and Colin for their help so far - the software is very promising, I just need to make sure it's as configurable as I need it to be, before taking the plunge and buying it.

Is it possible to put a button on each row, e.g. to update the status of that row to "complete" ?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 22,492Questions: 26Answers: 5,169
    Answer ✓

    Here are two examples of buttons.

    Uses columns.render:
    http://live.datatables.net/qemodapi/1/edit

    Uses columns.defaultContent:
    http://live.datatables.net/xijecupo/1/edit

    Inside the click event you can use something like row().data() to update the row data.

    Kevin

  • supportNEsupportNE Posts: 23Questions: 7Answers: 0

    Thanks Kevin ! I'll try to make sense of this within what I'm doing.

  • supportNEsupportNE Posts: 23Questions: 7Answers: 0

    Hi @kthorngren - thanks for the answer, if you are still about, I've got stuck with using the buttons. I'm attempting to use editor, and having placed the buttons as per the example, when I click the buttons I get an "Unable to automatically determine field from source" error.

    Many thanks

  • kthorngrenkthorngren Posts: 22,492Questions: 26Answers: 5,169

    Unable to automatically determine field from source

    Did you read through the technote link provided in the error?
    https://datatables.net/manual/tech-notes/11

    If this doesn't help then at a minimum we will need to see your Editor and Datatables configs and your button click event code. If nothing is obvious from that we will ask for a link to your page or test case. If you want to build a test case you can start with this base Editor example:
    http://live.datatables.net/guwafemu/1/edit

    Kevin

  • supportNEsupportNE Posts: 23Questions: 7Answers: 0

    Hi Kevin

    Thanks for getting back to me, I've solved the issue by doing this :

        // Activate an inline edit on click of a table cell
        $('#example').on('click', 'tbody td:not(:first-child) td:not(:nth-child(2))', function (e) {
            editor.inline(this);
        });
    
This discussion has been closed.