Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Udaya on Jun 18, 2008 06:44
open dhtmlx forum
retrieve values when doing smart rendering

Hi iam using server side smart rendering for a grid.Iam trying to move the row up and down in the grid.Iam also trying to retrieve the modified values in the same order as it is in the grid.
My problem is that iam unable to get the values of unrendered rows.Hence the array where iam pushing a particular cell value in a for loop is not geting accessible outside the for loop.


    function getAllValues()
    {
        alert(mygrid.getRowsNum());
        var values=[];
        for(var i=0;i<mygrid.getRowsNum();i++)
        {    
            alert("values"+values);
            values.push(mygrid.cells(mygrid.getRowIndex(i),0).getValue());

        }
        alert(" outer values"+values);
    }

The outer alert doesnt gets displayed unless all the rows are rendered

How to to get the values of unrendered rows in that array???
Answer posted by Support on Jun 18, 2008 09:20

>>Hi iam using server side smart rendering for a grid.
If you are using dynamic server side sorting - the situation is possible when row in question just not loaded yet - in such case you will not be able to access data.

In case of static smart rendering ( when all data loaded to client side at once ) your approach can work, but current code is incorrect , you are mixing row ID and row indexes. 

function getAllValues() 
  { 
  var values=[]; 
  for(var i=0;i<mygrid.getRowsNum();i++) 
  {
       var id=mygrid.getRowId(i);
       mygrid.getRowById(id); //force rendering
       values.push(mygrid.cells(id,0).getValue()); 
  } 
  alert(" outer values"+values); 
  }