Jump to content

Expand/collapse (show/hide) a RawWidget in a Grid


maher

Recommended Posts

Hello,

1 - We use this code   to Expand /Collapse Raw Widget

while not qrySrv.Eof do

begin

  with grdSrv, JSInterface do

   begin

     JSCall('getPlugin().toggleRow',[qrySrv.RecNo-1, JSStatement(JSName+'.getStore().data.items['+IntToStr(qrySrv.RecNo-1)+']')])

   end;

  qrySrv.Next;

end;

 

But this code will Expand a collapsed row  and Collapse expanded row  !!!

 

How I can Expand all rows / Collapse all rows , I mean how I can check the if the row is Expanded/Collapsed

 

Like

 

while not qrySrv.Eof do

begin

  with grdSrv, JSInterface do

   begin

    if (RowIsExpand  and OpIsCollapse***) or  (RowIsCollapse and OpIsExpand***)   then

     JSCall('getPlugin().toggleRow',[qrySrv.RecNo-1, JSStatement(JSName+'.getStore().data.items['+IntToStr(qrySrv.RecNo-1)+']')])

   end;

  qrySrv.Next;

end;

 

 

TAHNX

 

Link to comment
Share on other sites

Try to analyze and use this code.

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniDBGrid1, UniDBGrid1.JSInterface do
    JSCode('if ('+ JSName +'.getPlugin("rowWidget").recordsExpanded['+ DataSource.DataSet.RecNo.ToString +']) {'+ JSName +'.getPlugin("rowWidget").toggleRow('+ (DataSource.DataSet.RecNo-1).ToString +', '+ JSName +'.getStore().data.items['+ (DataSource.DataSet.RecNo-1).ToString +'])};')
end;

 

Link to comment
Share on other sites

Hello,

1 hour ago, maher said:

I tried it but i got error :

image.png.4df5a221532c1d0271985dddd99b60d1.png

Don't know. I couldn't reproduce.

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniDBGrid1, UniDBGrid1.JSInterface do
  begin
    DataSource.DataSet.First;
    while not DataSource.DataSet.Eof do
    begin
      JSCode('if ('+ JSName +'.getPlugin("rowWidget").recordsExpanded['+ DataSource.DataSet.RecNo.ToString +']) {'+ JSName +'.getPlugin("rowWidget").toggleRow('+ (DataSource.DataSet.RecNo-1).ToString +', '+ JSName +'.getStore().data.items['+ (DataSource.DataSet.RecNo-1).ToString +'])};');
      DataSource.DataSet.Next;
    end;
  end;
end;

 

Link to comment
Share on other sites

Hello...

 

 

with UniDBGrid1, UniDBGrid1.JSInterface do
  begin
    DataSource.DataSet.First;
    while not DataSource.DataSet.Eof do
    begin
      JSCode('if ('+ JSName +'.findPlugin("rowwidget").recordsExpanded['+ DataSource.DataSet.RecNo.ToString +']) {'+ JSName +'.findPlugin("rowwidget").toggleRow('+ (DataSource.DataSet.RecNo-1).ToString +', '+ JSName +'.getStore().data.items['+ (DataSource.DataSet.RecNo-1).ToString +'])};');
      DataSource.DataSet.Next;
    end;
  end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...