Accessing row data from Nested DataTable

Accessing row data from Nested DataTable

menashemenashe Posts: 196Questions: 43Answers: 2

When dealing with "regular" DataTable rows, I can access the underlying data by using the following:

        pricesEditor.on('open', function(e, mode, action) {

            ...

            priceData = pricesTable.row({
                selected: true
            }).data();
        });

How can I access the data from a row in a Nested DataTable?

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951

    You will need to access the API of the nested table, ie replace pricesTable with the nested table API. The next question is how to access the nested Datatable API. That depends on how you are nesting the Datatables. Are these in Child Detail Rows or something else. Maybe you can post the relevant code showing your nested Datatable soluition.

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you are using a datatable field type, it has a dt() method to get the DataTable API instance - e.g.:

    editor.field('myTable').dt().row({selected: true}).data();
    

    Allan

  • menashemenashe Posts: 196Questions: 43Answers: 2

    Hi Allan,

    I thought that editor.field takes a field name?

    I have not been able to get it to work. I am using a datatable field type, but I am not sure what field name to use!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I thought that editor.field takes a field name?

    It does. I just used myTable as a placeholder. In this example it would be 'users.site'.

    Perhaps you can show me your full code, or give me a link to a page showing the issue?

    Allan

Sign In or Register to comment.