How to traverse the whole TTIWDBAdvWebGrid

Hi,


     I tried looking in the 'TTIWDBAdvWebGrid' manual, FAQ and I didn't find a simple way to traverse the WHOLE grid without using page reference in order to check something of interest like whether a row is selected or not.

      I know about the 'RowOffset', 'Row', 'RowTot' properties, but all these but the last one refer to the current page . The only way to do what I asked is to manually make a looping for all pages and traverse row to row of that page?

     What is the simplest way to traverse the WHOLE grid wthout using the page mechanism?

  Thanks for your attention.

Joao Lira.

Hi,


Can you please try using the example below?

Example:
var
  I: integer;
begin
  IWMemo1.Clear;
  for I := 0 to TIWDBAdvWebGrid1.DataSource.DataSet.RecordCount -1 do
  begin
    IWMemo1.Lines.Add(BoolToStr(TIWDBAdvWebGrid1.RowSelect, true));
  end;
Hi,

It worked, thanks! It needed only a fix in the 'RowSelect' reference, as it is an array:

IWMemo1.Lines.Add(BoolToStr(TIWDBAdvWebGrid1.RowSelect, true));

You pointed one way to check whether a row is selected or not using the 'DataSet' associated with the 'TTIWDBAdvGrid', and it solved my needs for the moment. So, through the internal component properties this isn't possible in the current version? Not only for this, but for anything else the user could need.

I think this would be very useful to the users of this component.

Thank you!

'RowSelect', I meant.

What a crazy behavior of the forum editor! it is stripping off the open and close array symbol.

Hi,

That example , as I told, worked for traverse the 'DBGrid' and check whether some specific row is checked or not. Ok but, for example, if it be checked I have to do some processing using data of that record, using a reference like 'TTIWDbAdvGrid.CellValues[SomeCol,SomeRow]'. The problem is that the index for 'DBGrid.RowSelect[x]' is global but for 'CellValues' is page related. Is there some formula to make the global index become  'Col,Row' values? I think the component should provide a global index to access a row whatever page it is located. This is very important! What do you think?

Thanks for your attention.

Joao Lira.

Hi,


Nevermind about the global variables and CellValues. It index IS global as well. Problem solved. Thanks!
Hi,


An update on this case that I just realized: I don't know whether this is a bug or not, but the looping you used in your example only works if the 'TTIWAdvWebGrid.Page = 0'. In a multipage 'DBGrid' if 'Page' is <> 0 the cell content works only for the current page. For 'Page = 0' the cell content works for the whole 'DBGrid'. When I tell 'works' I mean the content of 'CellValues[Col,Row]'. When 'Page > 0' 'CellValues[Col,Row] = <EMPTY>' for a looping like that. Is that normal or is it a bug?

Ragards,
Joao Lira.

When BBcodes are enabled the forum will automatically strip square brackets from your message. You can disable BBcodes by unchecking the checkbox below the message text area.

When using paging you can subtract the RowOffset value from the row index.

Example:
TIWDBAdvWebGrid1.CellValues[0,I - TIWDBAdvWebGrid1.RowOffset]

Ok, thanks!

I guess that when there is only one page 'RowOffset' = 0, right?

Thank you, again.

Joao Lira.

Yes, that is correct.