Author Topic: How to get rowIndex through cell value  (Read 5681 times)

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
How to get rowIndex through cell value
« on: April 22, 2014, 10:13:04 am »
Hi,

I tried to get rowIndex by using the cell value. For example if am giving the cell value like VOYAGE it needs to print the rowIndex like 2. I used the following code

       var obj = $( "#VoyageDetails_tab_main" ).pqGrid( "getRowIndx", {tr:"VOYAGE HEIGHT"});
       var rowIndx = obj.rowIndx;
       alert(rowIndx);

am always getting undefined only. What i need to put in that colored area or else what i did wrong. Any one help me.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to get rowIndex through cell value
« Reply #1 on: April 22, 2014, 01:05:39 pm »
getRowIndx can't get rowIndx from a cell value. you could use this code to get rowIndx from cell value.

var data=$grid.pqGrid( 'option', 'dataModel.data' );
var rowIndx;

for (var i=0;i<data.length;i++){
  var rowData=data[ i ];
  for(var dataIndx in rowData ){
    if(rowData[dataIndx] == "VOYAGE HEIGHT"){
       rowIndx = i;
       break;
    }
  }
}

alert( rowIndx );

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Re: How to get rowIndex through cell value
« Reply #2 on: April 22, 2014, 06:06:26 pm »
Thanks For your reply. It is performing nice.