I need to hide a column on the table, but after that I cannot read selected row's hidden column value.
dtTable = $('#lookupTable').DataTable({
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
}
],
aaData: data,
aoColumns: cols,
paging: false,
scrollCollapse: true,
destroy: true
});
as you see the first column is hidden now. And I am trying to read the column value with that code
selectedIndex = $(this).find('td:eq(0)').text();
if i delete <"visible": false> from the code i can read the first column's value, but if it is hidden it gives me second column value.
I tired to change "witdh" property but it didnt work..
#3 jQuery Code To Get hidden field value by typevar getValue= $("input[type=hidden]"). val(); alert(getValue); Here in the above jquery code, we select input hidden filed by its type i.e hidden, and then by using jquery . val() we get the hidden field value.
Definition and Usage. The <input type="hidden"> defines a hidden input field. A hidden field lets web developers include data that cannot be seen or modified by users when a form is submitted. A hidden field often stores what database record that needs to be updated when the form is submitted.
Right click on project and select Add-->Add New Item and select Web Form. Add a new Web Form called "Default. aspx". Now, drag and drop the HiddenField Control on the page.
The correct answer is pretty old. So, if the correct answer does not work out for you. Please try this method :
selectedIndex = dtTable.row(this).data();
This code will return the raw json object which was fetched for this row. something like :
{
"modify":"false",
"lastModify":"Tuesday",
"name":"abc",
"DT_RowId":"row_1",
"fileID":"0bde976"
}
To get the "fileID" you just need to :
alert("ID = "+selectedIndex.fileID);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With