cannot read row values on client side when using Editor
cannot read row values on client side when using Editor

I included some columns on client side using render for example
{ data: null,
render: function (data, type, row)
{
// var numFormat = $.fn.dataTable.render.number( ",", ".", 0 ).display;
}},
and it works fine but when I try to read the values of all rows using :
var data = tablecontracts
.rows()
.data()
it only shows the those columns which are read from server side and doesn't show the columns with NULL values.
How can I read all the data into an array for all columns including the NULL one?
Please
Thank you
Answers
The
cell().render()
orcells().render()
are used for getting the rendered values.Kevin
@kthorngren Thank you
I use this var plainArray = table.columns().data().toArray(); to access the columns/rows of data. But this doesn't show me the null values. for example, in the code above , I am able to access first two but not the thrid value (null).
How can I access all the values of datatble inside one variable?. in this case all inside var PlainArray?
To access the "rendered" data you will use either
cell().render()
orcells().render()
. You my need to access the "data" values separately from the rendered values and combine them.Kevin
Thank you very much. I have tried few options but I will delete my comment. Will try to read the documentation properly and if there is any problem I will get back to you thank you
You need to specify the
type
parameter, such asdisplay
, for example:var plainArray1 = table.cells().render("display");
Here is a running example:
http://live.datatables.net/wobesota/1/edit
Kevin
Thank you @kthorngren
works perfect. I forgot to add display.
However, is it possible to add a break so each row is saved separately rather than everything gets saved in one array.
Could possibly break the array in in two sub arrays, but is there is way to add break ?
The
cells()
API returns an array of the selected cells. Its not a row based API. There is not a Datatables API I'm aware of to do what you are asking. You will need to create a JS loop to create a row based array of arrays.Kevin
Thank you .
I tried to run this loop, however with each row iteration, it is still outputting the render data in one single array
Like I said you will need a Javascript solution. Take a look at this Stack Overflow thread for some ideas.
Kevin