Update DB GRID Columns...

Hello,

I've placed a TIWDBAdvWebGrid1 with Property AutoAddAllField to true...
All is ok for the first time I connect my grid to a datasource... I've got the correct number of columns...
But if I change the datasource dynamically, the grid don't update all columns : I still see some collumns of the first datasource, if this one have more fields than the second datasource... Even if I do  TIWDBAdvWebGrid1.Columns.Clear;
before changing the datatsource...

How can I update the display, Please ? 
(in order to only see my fields of the second datasource)

With best regards,
Herv?
Hello,

I've found a solution :
I've placed a Iwtimer with this code in the ontimer event... :

procedure TIWForm10.IWTimer1Timer(Sender: TObject);
begin
    TIWDBAdvWebGrid1.DataSource.DataSet.Refresh;
   IWTimer1.Enabled:=false;
end;

It's not very nice ... Do you have a better sollution ?

With best regards,
Herv?
 
Hello,

I was using an IWLabel component with the OnAsynclick event to change the datasource... :

procedure TIWForm10.IWLabel1AsyncClick(Sender: TObject;
  EventParams: TStringList);
begin
    TIWDBAdvWebGrid1.Columns.Clear;
    TIWDBAdvWebGrid1..DataSource:= US_session.dst2;
end;

If I use the same code Inside a IWButton Onclick event :
procedure TIWForm10.IWButton2Click(Sender: TObject);
begin
    TIWDBAdvWebGrid1.Columns.Clear;
    TIWDBAdvWebGrid1..DataSource:= US_session.dst2;
end;

All is ok :)

Better than using a Timer :)

With Best Regards,
Herv?