CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Simple, select a row in grid ...

by jorgo » 21 Jun 2017 10:03

Hi,
we have a filled grid.
column = 0 has checkboxes

Now I check the checkboxes in rows 1,3,5 -> Ok

Code: Select all
procedure TForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject; AParams: TStringList);
begin
   IWCGJQGrid2.JQGridProviderCells.Rows.CellValue[0, 1] := 1;
   IWCGJQGrid2.JQGridProviderCells.Rows.CellValue[0, 3] := 1;
   IWCGJQGrid2.JQGridProviderCells.Rows.CellValue[0, 5] := 1;
   IWCGJQGrid2.JQGridOptions.ReloadGrid;
end;


How can I select row = 3 (like clicking on it)?

Kind regards
jorgo
 
Posts: 108
Joined: 13 Jul 2016 15:57

by jorgo » 21 Jun 2017 11:08

Hi,

the button is not on the grid.
It's a button direct on the from.

I tested following, but it didn't select row = 3:

tmpRowId := IWCGJQGrid2.RowId[3];
IWCGJQGrid2.JQGridOptions.SetSelection(tmpRowId, True);
jorgo
 
Posts: 108
Joined: 13 Jul 2016 15:57

by Alexander Bulei » 21 Jun 2017 11:22

Hi jorgo,

This topic will help you: viewtopic.php?f=34&t=1744

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by jorgo » 21 Jun 2017 14:03

Hi,

IWCGJQGrid2.JQGridOptions.ReloadGrid;
IWCGJQGrid2.JQGridOptions.SetSelection(3, True);

Call of both methods in one event doesn't work.
The selection is shown for milliseconds before the grid is repainted without a selection.

So I need an event after "ReloadGrid" is performed.
I took onLoadComplete:

Code: Select all
procedure TForm1.IWCGJQGrid2JQGridOptionsLoadComplete(Sender: TObject; AParams: TStringList);
begin
   try
      IWCGJQGrid2.JQGridOptions.SetSelection(3, True);
   except
   end;
end;
jorgo
 
Posts: 108
Joined: 13 Jul 2016 15:57

by Jorge Sousa » 21 Jun 2017 14:28

Hi Jorgo

You did the right thing

My colleague didnt understand you well, he thought you want to track the selected row, not to select a specific row,
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by jorgo » 21 Jun 2017 15:45

Hi,

if I combine
IWCGJQGrid2.JQGridOptions.SetSelection(x, True);

with
IWCGJQGrid2.JQGridOptions.ScrollRows := True;

grid is scrolled to the last selected row. :D
jorgo
 
Posts: 108
Joined: 13 Jul 2016 15:57

by Jorge Sousa » 21 Jun 2017 16:19

remember that the first parameter of setSelection is the rowid not the rownumber, can you send us a test case, please? t.i.a.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by jorgo » 26 Jun 2017 15:50

Ups,

was this the wrong smilie?
It works as I want it.

The bigger problem is to update visual components during a long runing calculation.
Now I use timers and run it part for part but it's ugly source code.

Kind regards
jorgo
 
Posts: 108
Joined: 13 Jul 2016 15:57


Return to JQGrid

Who is online

Users browsing this forum: No registered users and 3 guests

Contact Us.