Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott Baley on Aug 14, 2008 07:48
open dhtmlx forum
Get filtered Row ID Part 2

Hello,

You kindly answered a question for me on how to tertive the IDs of all rows after a filter has been done. I can now do this. My further question now is can you return specific calues of these rows. I have a working example where I loop through the resulting array and get each value but this is incredibly slow. ( on a grid with about 900 rows and 20 columns).

This is my code.

var ids=[];
for (var i=0; i<mygrid.getRowsNum(); i++)
   ids.push(mygrid.getRowId(i));

This works fine , then I loop through the ides to get ids and add them to a select list. This all works fine and fast until I add the following line.

cellval=mygrid.cells(ids[i],colid).getValue()

full code for the block is

var elSel = document.getElementById('esnlist');
var colid=mygrid.getColIndexById("Name");
 var colid2=mygrid.getColIndexById("Access Charge No");
 var cellval;

for (var i = 0; i < ids.length; i++)
   {

var cellval=mygrid.cells(ids[i],colid).getValue()

var elOptNew = document.createElement('option');
         elOptNew.text = ids[i];
         elOptNew.value = ids[i];
         elOptNew.selected = true;
        

         try {
             elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
           }
           catch(ex) {
 
            elSel.add(elOptNew); // IE only
           }
   
   
   }

If I comment out the line first line in the loop it flies, when I use it I get messages about slow running scripts in IE7.

Many thanks

Scott Bailey

Answer posted by Support on Aug 14, 2008 09:10
To get value from the row, it need to be parsed - whcih will remove any performance gained by smart rendering or paging modes. 
The next line can be used instead of current one , it must be a lot faster , but it has its own limitation and can't be used for complex cell types. 

for (var i = 0; i < ids.length; i++){
       var cellval=mygrid._get_cell_value(mygrid.rowsAr[ids[i]],colid)


Answer posted by Scott Bailey on Aug 14, 2008 09:23

Hello,

I am getting the error. Object doesn't support this property or method. The column I am lookng at is a editable text column.

Scott Bailey

Answer posted by Support on Aug 15, 2008 01:48
Please check attached sample. 
Attachments (1)