I've got a self-referencing hierarchical grid that displays the information as desired. When the user clicks a row, s/he can then either view the row's details, reply to the thread or delete the thread.
The problem I'm having is capturing the Id of the selected row. The Id is stored in the first column of the grid, which also contains the [+] button code (visible or not, depending on whether there's a child row). For other columns, the following to retrieve the cell's contents as desired:
var rgGrid = $find("<%= grdNotes.ClientID %>");
var MasterTable = rgGrid.get_masterTableView();
var selectedRows = MasterTable.get_selectedItems();
for (var i = 0; i < selectedRows.length; i++)
{
var row = selectedRows[i];
var cell = MasterTable.getCellByColumnUniqueName(row, uniqueColName)
parentId = cell.innerHTML;
}
However, when the uniqueColName is the "Id" column, I also get back the HTML that creates the [+] button (when all I want is 21):
<input type="submit" name="ctl00$DetailBodyPlaceHolder$ucNotesGrid$grdNotes$ctl00$ctl10$MyExpandCollapseButton" value="" id="ctl00_DetailBodyPlaceHolder_ucNotesGrid_grdNotes_ctl00_ctl10_MyExpandCollapseButton" class="rgExpand" style="visibility:hidden;" /> 21
I've tried moving the button to its own column, but have been unsuccessful.
How can I read the Id value w/o getting the [+] code back as well? Is there another property that will just return the value (e.g., 21)?
Also, how can I make the detail row line up with the parent row vs. being indented?
The problem I'm having is capturing the Id of the selected row. The Id is stored in the first column of the grid, which also contains the [+] button code (visible or not, depending on whether there's a child row). For other columns, the following to retrieve the cell's contents as desired:
var rgGrid = $find("<%= grdNotes.ClientID %>");
var MasterTable = rgGrid.get_masterTableView();
var selectedRows = MasterTable.get_selectedItems();
for (var i = 0; i < selectedRows.length; i++)
{
var row = selectedRows[i];
var cell = MasterTable.getCellByColumnUniqueName(row, uniqueColName)
parentId = cell.innerHTML;
}
However, when the uniqueColName is the "Id" column, I also get back the HTML that creates the [+] button (when all I want is 21):
<input type="submit" name="ctl00$DetailBodyPlaceHolder$ucNotesGrid$grdNotes$ctl00$ctl10$MyExpandCollapseButton" value="" id="ctl00_DetailBodyPlaceHolder_ucNotesGrid_grdNotes_ctl00_ctl10_MyExpandCollapseButton" class="rgExpand" style="visibility:hidden;" /> 21
I've tried moving the button to its own column, but have been unsuccessful.
How can I read the Id value w/o getting the [+] code back as well? Is there another property that will just return the value (e.g., 21)?
Also, how can I make the detail row line up with the parent row vs. being indented?