3.2.0

Example Please To Find Row In Grid (based on a columns value)

Please Show Example Code To Locate (Find First, Find Next) Row In Grid (based on a columns value) - Thanks
Andy
February 11,
function ch_N(s){
if(s == '') return 0;
re = / /gi;var s2 = s.replace(re, "");s=s2.replace(",",".");
return parseFloat(s);
}

//filtering value from to: example 100:200 from 100 to 200
function filter(){
var m1,m2;
var supinf='';
var montant=document.saisie.montant.value;
var Res = montant.indexOf(":");
if(Res != -1){m1=montant.substring(0,Res);m2=montant.substring(Res+1);m1=ch_N(m1);m2=ch_N(m2);supinf='4';} 

if(montant.substring(0,2) == '>=' )      {supinf='0';montant=montant.substring(2);}
else if(montant.substring(0,1) == '>' )  {supinf='1';montant=montant.substring(1);}
else if(montant.substring(0,2) == '<=' ) {supinf='2';montant=montant.substring(2);}
else if(montant.substring(0,1) == '<' )  {supinf='3';montant=montant.substring(1);}
else if(montant.substring(0,1) == '=' )  {supinf=''; montant=montant.substring(1);}

var ttc=ch_N(montant);

var i, rows = [], max = data2.length;

 if(supinf == '')   for(i=0; i<max; i++){if(ch_N(data2[i][6]) == ttc) rows.push(i);} 
 if(supinf == '0')  for(i=0; i<max; i++){if(ch_N(data2[i][6]) >= ttc) rows.push(i);} 
 if(supinf == '1')  for(i=0; i<max; i++){if(ch_N(data2[i][6]) > ttc) rows.push(i);} 
 if(supinf == '2')  for(i=0; i<max; i++){if(ch_N(data2[i][6]) <= ttc) rows.push(i);} 
 if(supinf == '3')  for(i=0; i<max; i++){if(ch_N(data2[i][6]) < ttc) rows.push(i);} 
 if(supinf == '4')  for(i=0; i<max; i++){var m0=ch_N(data2[i][6]);if(m0 >= m1 && m0 <= m2) rows.push(i);} 


 var index0=rows[0];
 obj.setVirtualMode(rows.length>50);

 obj.setRowCount(rows.length);obj.setRowIndices(rows);
 if(rows.length>0){ obj.setSelectedRows([index0]);obj.setCurrentRow(index0);}
 obj.refresh();

 obj.element().focus();
}
thierry
February 11,

This topic is archived.

See also:


Back to support forum