How to manage datatable rows?

How to manage datatable rows?

Diego ApuglieseDiego Apugliese Posts: 8Questions: 3Answers: 0
edited May 2020 in Free community support

Dears,

I’ve been testing the extension functionality of datatable and i noticed that it works perfectly.

I wanted to ask the community if any article exists or if someone knows how can I handle the datatable that are “selected”. I understand that the table is an array and I would want to generate a new one but only with selected data in order to process them.

Attentive to any contribution.

Thank you very much

Diego.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    Are you using the Select Extension? If so this example shows how to use the API to get the selected rows.

    Kevin

  • Diego ApuglieseDiego Apugliese Posts: 8Questions: 3Answers: 0

    First of all, thank you for your answer.

    Yes, I'm using the Select Extension option.

    I was reading the article you shared me and it was really helpful.

    However I have a doubt: Is the following function return an object array?
    - "table.rows( { selected: true } );"

    I want to use the selected rows data as an object array. Is it possible?

    Thanks in advance.

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    Answer ✓

    Yes, rows() returns an API instance with all the rows. You can chain the toArray() API to get a Javascript array.

    Kevin

  • Diego ApuglieseDiego Apugliese Posts: 8Questions: 3Answers: 0

    Perfect!!! That's excactly what I need it!
    I noticed that this sentences also permit us to get an array of the selected ítems.

    var fila = mitabla.rows( { selected: true } );
                    array = fila[0];
    
    
This discussion has been closed.