How can i show data value hidden column?
How can i show data value hidden column?
Hi, when i hide a column, after i can't get the value if i put this html
<a>Date</a>: <output id="date"></output>
Code to hide column
"columnDefs": [ { "visible" : false, "targets": [2], "searchable": true} ],
My idea is: In this datatable show Name and Last name.
And if i click on Edit option i want to get Name, Last Name and Date. I Dont want show Date Column in the datatable, but if i hide the column i cant get the date value.
I dont know how to hide column and get the value with output for example.
Thanks
Replies
How are you fetching the row data now?
The best way is to use
row().data()
. You can access the data from the hidden column.Kevin
This is all my code
And html this
How can i use row.data in my code to accesos the data hidden column?
I don't see the event handler for your button but that is where you would use it to get your row data. See this example:
http://live.datatables.net/xijecupo/1/edit
Kevin
This is the code from my edit button
How can i add row().data() ?
Is this using Editor? And how are you hiding the column? Are you using
column().visible()
?Colin
With this code
"columnDefs": [
{ "visible" : false, "targets": [2], "searchable": true}
],
I used too
column().visible()
But i dont know how to show data from hidden column.
My example shows how to get data from the row of the clicked button. Here is the click event from one of the buttons:
You have
fila = $(this).closest("tr");
. To get the data usevar data = table.row( fila ).data();
. Your data is object based so use something like this to get the values:Then use the data as you normally would.
Kevin