Yes here is some code:
procedure tform1.setgroupbuttons(obergruppe:integer);
var aitem:twebresponsivegriditem;
foundgroup:boolean;
begin
begin
foundgroup:=false;
dm.cdsag.first;
repeat
if dm.cdsag.FieldByName('OBERGRUPPE').AsInteger=obergruppe then
foundgroup:=true;
dm.cdsag.Next;
until dm.cdsag.eof;
if foundgroup then
begin
webrg.BeginUpdate;
webrg.items.Clear;
begin
if obergruppe>0 then
begin
aitem:=webrg.Items.Add;
aitem.HTML:='<strong>Zurück '+inttostr(obergruppe)+'</strong>'+
'<br><IMG width="96px" src="img/Back.png">';
aitem.Tag:=100000;
end;
end;
dm.cdsag.First;
repeat
if dm.cdsag.FieldByName('OBERGRUPPE').asinteger=obergruppe then
begin
aitem:=webrg.Items.Add;
aitem.HTML:='<strong>'+dm.cdsag.FieldByName('BUTTONTEXT').asstring+'</strong>';
{'<br><IMG width="96px" src="img/'+dm.WDSAnzeigegruppenPICTURE.asstring+'">';}
aitem.Tag:=dm.cdsag.FieldByName('ID').AsInteger;
end;
dm.cdsag.Next;
until dm.cdsag.eof;
webrg.EndUpdate;
end else
begin
end;
end;
end;
procedure TForm1.WebRGItemClick(Sender: TObject; Index: Integer);
var aitem:twebresponsivegriditem;
agr:integer;
begin
aitem:=webrg.items[index];
agr:=aitem.Tag;
if agr>1000000 then
begin
BucheArtikel(aitem);
end else
begin
if agr=100000 then
agr:=0;
setgroupbuttons(agr);
end ;
{ dm.WDSAnzeigegruppen.Close;
dm.WDSAnzeigegruppen.QueryString:='$filter=(OBERGRUPPE eq '+inttostr(dm.aobergruppe)+')&$orderby=BTNNR';
dm.wdsanzeigegruppen.Load; // ----------> afteropen }
end;
Explanation:
cdsag is a twebclientdataset wihe 3 Fields, ID(integer), Buttontext (string) and Obergruppe (integer). It has 4 records with Obergruppe = 0 and 100 Records with Obergruppe >0.
After start the program calls setgroupbuttons(0) and the four items where shown. Then click on one the items are shown as expected.
After click the Back-Button the 4 Buttons with Obergruppe = 0 where shown and the error message was visible. You can continue, the program isch still working as expected.
I did watch it with debugger, it seems the loop repeat .. until brings the problem