How to address a cell that is in a hidden column and populated by .jsp
How to address a cell that is in a hidden column and populated by .jsp
dogcatgoat
Posts: 38Questions: 0Answers: 0
Hi,
I am learning JQuery and the DataTables API, so sorry if I am mixing concepts.
I am trying to find a value in my table that is hidden by addressing the selected row and a fixed (hidden) column.
I use fnGetSelected() to get the row that is highlighted.
From here, I would like to find a cell in the selected row at a particular column (2).
I was trying to access oTable.fnGetData[row][column] since it holds all of my data in the table (it has the hidden columns too). This array is ordered, though, in terms of a database fed by .jsp, not in terms of how it is shown in DataTables (sorted in another way). In other words since the rows in the array match the database, not the DataTable representation fnGetSelected() does not point to the correct index in the array that I need.
Can anyone help me either write a new function fnGetSelectedRowInDatabase(), etc. or something that is more elegant than what I am doing?
Thank you very much!
I am learning JQuery and the DataTables API, so sorry if I am mixing concepts.
I am trying to find a value in my table that is hidden by addressing the selected row and a fixed (hidden) column.
I use fnGetSelected() to get the row that is highlighted.
From here, I would like to find a cell in the selected row at a particular column (2).
I was trying to access oTable.fnGetData[row][column] since it holds all of my data in the table (it has the hidden columns too). This array is ordered, though, in terms of a database fed by .jsp, not in terms of how it is shown in DataTables (sorted in another way). In other words since the rows in the array match the database, not the DataTable representation fnGetSelected() does not point to the correct index in the array that I need.
Can anyone help me either write a new function fnGetSelectedRowInDatabase(), etc. or something that is more elegant than what I am doing?
Thank you very much!
This discussion has been closed.
Replies
I am still confused about how to access a key in a hidden column that is currently highlighted when a button is pressed. Getting the currently highlighted row returns a value depending on how the column is being sorted. Accessing the key with fnGetData does not take into account sorting. What am I missing to correlate the two?
Thank you.
- Dan
[code]
var SelectedRowContents=oTable.fnGetData( $('#project_table tbody tr.row_selected')[0] );
var project_key= SelectedRowContents[0]; // get the 1st hidden column
[/code]