QuantumGrid - fazer um while nos dados da grid sem usar o dataset

Top  Previous  Next

O código abaixo mostra como percorrer os dados de um QuantumGrid sem precisar usar o dataset visto que muitas vezes a ordenação do ClientDataSet é diferente da ordenação do grid.

 

Email vindo da devexpress (original):

Thank you for the message.  You need to use the view's Datacontoller property.  The DataContoller is a separate matrix which keeps data loaded from a dataset.  So when the dataset is changed, by default the view's DataController clears its data storage and loads all the dataset's records again.  

 

As for iterating rows depending on Grid's sorting, you can use the View's ViewData object and its Rows property to iterate the rows within the View.

I suggest that you review the Quantum Grid's "Records" and "TcxGridTableView.ViewData" help topics.  For instance, the code below shows how it can be done.

...

var

  I: integer;

begin

  ...

  with cxGrid1DBTableView1.ViewData do

    for I := 0 to RowCount - 1 do

    begin

      ...   

      if not Rows[I].Selected then

        AValue := Rows[I].Values[AColumnIndex];

      ...

     end;

end;