Getting rows values as array
Getting rows values as array
jigar311982
Posts: 70Questions: 31Answers: 0
Hello,
I am trying to get multiple selected rows values as an array but unfortunately it comes as object only,
console.log(table.rows({'.selected').data());
var ids = jQuery.map(table.rows('.selected').data(), function (item) {
return item[3];
});
console.log(ids);
by using this code i am getting
[object, object, object,context:array[1]....]
but i could not get like...
[array, array, array...]
What is wrong with this?
Thanks, if you need test page link let me know.
This discussion has been closed.
Answers
I got my answer, thanks
I am having the same problem can someone help please
Use the
toArray()
method to convert a DataTables API instance to an array.Allan
theArray=[];
var myValues= $('#miTabla').DataTable();
A slightly easier way:
That uses the
selector-modifier
to get the selected rows and thenpluck()
to get the data from the specific data point needed.Allan
Hello,
I am having same issue but I need is an entire row as array. Is that possible ? anything like table.rows('.selected').data().toArray() ? I am new to DataTables . Please help
Yes there is:
toArray()
.Kevin