iwadvwebgrid always colors the first row?

Setting up an iwadvwebgrid without column headers or controller so that the top of the grid is just the first row. I have a color set for the selected row and it does indeed show a row colored when clicked and using ClearRowSelect before setting ActiveRow makes just the selected row colored - except the first (0) row. How do you clear the color of the first row?

Hi,

I'm not sure what could be causing this issue.
Can you please provide exact steps to reproduce so I can further investigate this?

Thank you for the reply, Bart.

I have attached the portion of the application's .dfm file that sets up the webgrid. In the application, this code is used to fill the grid:

sp := split(msg,'|');
s := sp[0];
if strisnumbers(s) then begin
Memo1.Lines.Insert(0,'Loading '+ s);
J := strtoint(s);
//grid1.RowCount := J;
//grid1.TotalRows := J;
//grid1.InsertRows(0,J);
for I := 0 to J-1 do begin
grid1.Cells[0,I]:= IntToStr(I+1);
grid1.Cells[1,I]:= sp[I+1];
end;
grid1.AsyncUpdateAllCells;
grid1.RowCount := J;
grid1.TotalRows := J;
end else

msg is a long string returned by a websocket connection and delimited by the character |. 'split' converts the string into an array, the first member of which is the number of following strings to put into the grid. I first just had 10 rows in the definition of the grid and expected the 'grid1.rowcount := ' line to expand the number of rows, but that didn't work - it stayed at 10. So I gave it a large number in the design and truncate it after loading.

In the procedure Grid1AsyncGotoRow are the lines:

grid1.ClearRowSelect;
I := Row;
grid1.ActiveRow := I;

This correctly changes the green selected highlight to what ever grid row was clicked. My issue is that through all this, row 0 of the grid starts out and remains the green color. I would have thought ClearRowSelect would change every row to the background color. Is there a counterpoint to ActiveRowColor I should be using?

Thank you for your time.

..Dave

webgrid.dfm (20.9 KB)

I am currently investigating this issue and will report back as soon as possible.

Appreciate it. Thank you.

Unfortunately it's currently not possible to asynchronously remove the background color for the initial active row.

As a workaround can you please initialize the ActiveRow on -1 to avoid this issue?

Example:

procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
  TIWAdvWebGrid1.ActiveRow := -1;
end;

Thank you. That does the trick.

..Dave

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.