Page 1 of 2

Set Filter on JQGrid Column on create

PostPosted: 06 May 2019 10:32
by feland
Hi,
I will set a JQgrid filter on toolbar search as default on jqgrid load.

How I can do it? On attachment an example of How I want it.

The request is urgent.
Thanks

Re: Set Filter on JQGrid Column on create

PostPosted: 07 May 2019 11:00
by feland
Hi,
I solved the question using the following instruction:
gridFatturePass.JQGridColumns.ItemsByName[sColName].SearchOptions.DefaultValue := '2137600019'


but when I clear the filter clicking on button (x) (see the attachment) the filter is not deleted.

Why?

Thanks,
Feland

Re: Set Filter on JQGrid Column on create

PostPosted: 07 May 2019 16:04
by feland
It's very urgently please can you help me?

Re: Set Filter on JQGrid Column on create

PostPosted: 08 May 2019 08:13
by feland
Any news?

Thanks,
Feland

Re: Set Filter on JQGrid Column on create

PostPosted: 13 May 2019 08:15
by feland
Hi, any news?

the request is urgently.

Thanks feland

Re: Set Filter on JQGrid Column on create

PostPosted: 13 May 2019 09:37
by Alexander Bulei
Hi feland,

That property (default value), works in this way, on clear click the grid will revert the search input value with default value (if setted).
So, I think, you need something like this:

delphi code
procedure TIWForm2.IWCGJQGrid1JQGridOptionsLoadComplete(Sender: TObject; AParams: TStringList);
var
Def, Js: string;
begin
Def:= '444';
Js:= Format('$("#gs_%s").val("%s")', [IWCGJQGrid1.JQGridOptions.ColModel[0].Name, Def]);
CGAddJavaScriptToAjaxResponse(Js);
end;


Best Regards.

Re: Set Filter on JQGrid Column on create

PostPosted: 03 Jun 2019 10:08
by feland
Hi, but how can find the column where I clear the filter?

The event JQGridToolBarSearch.OnBeforeClear can't tell me what is the column name.

Thanks Feland.

Re: Set Filter on JQGrid Column on create

PostPosted: 03 Jun 2019 10:50
by Alexander Bulei
Hi feland,
I don't understand what you want to do..due you've asking about the setting filter on create...

Re: Set Filter on JQGrid Column on create

PostPosted: 03 Jun 2019 15:18
by feland
Hi,

if i set multiple filters on grid and I wanted to delete only one with the method recommended, How Can i do it?
In the command
Js:= Format('$("#gs_%s").val("%s")', [IWCGJQGrid1.JQGridOptions.ColModel[0].Name, Def]);
I need to specify the column position
Colmodel[0]
. How can I retrieve this information?

the Event JQGridToolBarSearch.OnBeforeClear don't give me that info.

Thanks.

Re: Set Filter on JQGrid Column on create

PostPosted: 03 Jun 2019 16:05
by Alexander Bulei
Hi feland,

I'm still not cleared about your issue.
Please describe better, when/which event? what? where?

The information that you provide is not enough.

How can I retrieve this information?


Use available methods on ColModel...

the Event JQGridToolBarSearch.OnBeforeClear don't give me that info.


Use the debugger and browser parameters if you need extra data:

viewtopic.php?f=5&t=3843

Best Regards.