Page 1 of 1
Link detection

Posted:
15 Apr 2014 08:27
by etwoss
Hi
As you can see there are two links in the grd (Product and Vendor)
How can i detect in the click event which one is clicked and whats the value?
Eric
Re: Link detection

Posted:
15 Apr 2014 09:43
by Jorge Sousa
Hi
I don't understand what you mean
if both columns have Formatter = gcfLinkClick you should have 2 events: Col[i].FormatOptionsLinkClick.OnClick
Re: Link detection

Posted:
15 Apr 2014 09:59
by etwoss
Hi
haha, right of course!!!
How to find out the values selected?
Eric
Re: Link detection

Posted:
15 Apr 2014 10:18
by Jorge Sousa
Hi
Now i do understand your question.
1- if You set Col.FormatOptionsLinkClick.SelectRow=True, you can use Grid.JQGridOptions.SelRow
2- Has you can see in the inspector, OnClick has the arguments = 'rowid,cellvalue'
You can add a OnClick.BrowserParam and use rowid or cellvalue as BrowserScript, or simply setting OnClick.SendAllArguments=True, then you can acess trough the AParams in the event handler.
Re: Link detection

Posted:
15 Apr 2014 10:18
by Jorge Sousa
Hi
Now i do understand your question.
1- if You set Col.FormatOptionsLinkClick.SelectRow=True, you can use Grid.JQGridOptions.SelRow
2- Has you can see in the inspector, OnClick has the arguments = 'rowid,cellvalue'
You can add a OnClick.BrowserParam and use rowid or cellvalue as BrowserScript, or simply setting OnClick.SendAllArguments=True, then you can acess trough the AParams in the event handler.
Re: Link detection

Posted:
15 Apr 2014 12:02
by etwoss
Hi
because this is generic code for a gridform where i do not know which columns will be selectable we have this code
- Code: Select all
for i := 0 to grid.JQGridOptions.ColModel.Count -1 do
begin
if (grid.JQGridOptions.ColModel[i].Formatter = gcfLinkClick) then
begin
grid.JQGridOptions.ColModel[i].FormatOptionsLinkClick.OnCLick.SendAllArguments := True;
grid.JQGridOptions.ColModel[i].FormatOptionsLinkClick.SelectRow := True;
grid.JQGridOptions.ColModel[i].FormatOptionsLinkClick.OnClick.OnEvent := gridJQGridOptionsColModel0FormatOptionsClick;
end;
end;
The Aparms in the procedure TFormAdminReportOverview.gridJQGridOptionsColModel0FormatOptionsClick(
contains this values (an example):
- Code: Select all
GRID_SELROW=7
IW_TrackID_=9
IW_SessionID_=0vfy7on1x14v61169d1o30vriu8r
callback=GRID.DoAjaxRequest
ajaxevent=JQGridOptions.ColModel.Items[0].FormatOptions.OnClick
rowid=7
cellvalue=Limited Function / Open
ComponentName=grid
So i now the cellValue but i also need to know the column name to see what the value is (A vendor , A Product?)
How to get this information?
I already See:
ajaxevent=JQGridOptions.ColModel.Items[0].FormatOptions.OnClick
It contains the colModel.Items[x]!!!
Eric
Re: Link detection

Posted:
15 Apr 2014 14:07
by Jorge Sousa
Hi
The Sender: TObject parameter in the event handler, is always the owner of the event
So, for
FormatOptionsLinkClick.OnClick
the Sender will be
procedure TIWForm1.LinkClick(Sender: TObject; AParams: TStringList);
var
FormatOptions: TIWCGJQGridFormatOptionsLinkClick;
begin
FormatOptions:= Sender as TIWCGJQGridFormatOptionsLinkClick;
FormatOptions.Col.Name; // This is the column
end;
Re: Link detection

Posted:
16 Apr 2014 07:39
by etwoss
Hi
TIWCGJQGridFormatOptionsLinkClick???
Can't find this class in sourcecode?
Which unit is this in?
Eric
Re: Link detection

Posted:
16 Apr 2014 10:10
by Jorge Sousa
Hi
Actually is
TIWCGJQGridColFormatOptionsLinkClick
in IWCGGrid.pas