Hi I am trying to use the getRowIndex to get the correct index of a particular row in a tree grid. However no matter what row is selected, if it's the first one, the 2nd or the 20th, it always returns a -1.
Here's the code I use this to refresh the treegrid.
function refreshGrid(grid_id){
var row = $('#' + grid_id).treegrid('getSelected');
console.log(row);
if(row){
var rowIndex = $('#' + grid_id).datagrid('getRowIndex', row['id']);
console.log(rowIndex); return false;
$('#' + grid_id).treegrid('refresh',row['id']);
$('#' + grid_id).treegrid('scrollTo',rowIndex);
$('#' + grid_id).treegrid('selectRow',rowIndex);
$('#' + grid_id).treegrid('highlightRow',rowIndex);
}
}
And here is a sample of the JSON being returned from the server:
[{"work_release_id":213,"poc_profile_id":201,"has_attach":"true","lvl":1,"can_add_pl":"true","col8":"NaN","col7":" $.00","col6":"","state":"closed","can_edit_header":"true","col5":"New Formulation In Process","appr_doc_id":0,"col4":"09/20/2023","col3":"08/10/2023","col2":" 700.00","col1":"ASO-0213-000 VI 2 ","wr_rev_id":235,"can_edit_title":"true","can_generate_afa":"false","can_read_formulation":"true","poc_name":"ABC DEF","can_cancel_formulation":"false","id":"1_213","can_return_to_contractor":"false","can_submit_to_cnt":"true","can_delete_formulation":"true","can_init_revision":"false","can_read_approved_cost_structure":"false","doc_set_id":4390,"can_display_graph":"true","Level":1,"can_cancel_revision":"false","can_unsubmit_to_cnt":"false","can_email_poc":"false","form_doc_id":4339,"is_complete":1,"can_approve_wp":"false","lk_status_id":100,"can_change_wr_notes":"true","wrname":"ASO-0213-000 VI 2 (ABC DEF)","can_paste_pl":"false","can_change_wrpoc":"false","can_send_file_to_contractor":"false","can_unsign_wp":"false"},{"work_release_id":212,"poc_profile_id":173,"has_attach":"true","lvl":1,"can_add_pl":"true","col8":"NaN","col7":" $.00","col6":"","state":"closed","can_edit_header":"true","col5":"New Formulation In Process","appr_doc_id":0,"col4":"08/14/2024","col3":"09/21/2023","col2":" 3000.00","col1":"AWA-0212-000 impact test (GHI JKL)","wr_rev_id":234,"can_edit_title":"true","can_generate_afa":"false","can_read_formulation":"true","poc_name":"GHI JKL","can_cancel_formulation":"false","id":"1_212","can_return_to_contractor":"false","can_submit_to_cnt":"true","can_delete_formulation":"true","can_init_revision":"false","can_read_approved_cost_structure":"false","doc_set_id":4363,"can_display_graph":"true","Level":1,"can_cancel_revision":"false","can_unsubmit_to_cnt":"false","can_email_poc":"false","form_doc_id":4268,"is_complete":1,"can_approve_wp":"false","lk_status_id":100,"can_change_wr_notes":"true","wrname":"AWA-0212-000 impact test (GHI JKL)","can_paste_pl":"false","can_change_wrpoc":"false","can_send_file_to_contractor":"false","can_unsign_wp":"false"}]
[\code]
Any help would be appreciated.