Limit the NG Filter + Free Search?

Forum to discuss the new web client version of Servoy.

Limit the NG Filter + Free Search?

Postby john1598360627 » Fri Oct 01, 2021 2:04 am

https://github.com/Servoy/svyPopupFilter/wiki

I'm curious how to do something with the PopupFilter, and the Free Search.

I want to limit the Filter & Search by a hidden pre-filter.

Example; Grid should show the records for a specific Period value. I want the Free Search results apply that Period filter always.

Right now I'm just using a query to limit the foundset initially, but I want to do it for the search results too.


I know this is possible somehow but I'm not sure which way to do so. onSearchCommand? onFilterApplyEvent? onFilterApplyQueryCondition? Auto Apply? Sorry I'm just confused which one is used for the case I'm talking about.
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm

Re: Limit the NG Filter + Free Search?

Postby paronne » Fri Oct 01, 2021 8:57 am

Hi John,

what you describe is possible indeed.
Using the onSearchCommand you can amend the generated Query adding extra conditions and load it into the foundset.
As in wiki https://github.com/Servoy/svyPopupFilte ... tom-search

Code: Select all
   // set the onSearchCommand
   toolbarFilter.setOnSearchCommand(onSearchCommand)

function onSearchCommand(query, fs) {
   // add custom conditions to the query
   query.where.add(query.columns.orderdate.not.isNull);

   // apply the query to the foundset
   fs.loadRecords(query);
}


Regards,
Paolo
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm

Re: Limit the NG Filter + Free Search?

Postby john1598360627 » Sat Oct 02, 2021 12:20 am

paronne wrote:Hi John,

what you describe is possible indeed.
Using the onSearchCommand you can amend the generated Query adding extra conditions and load it into the foundset.
As in wiki https://github.com/Servoy/svyPopupFilte ... tom-search

Code: Select all
   // set the onSearchCommand
   toolbarFilter.setOnSearchCommand(onSearchCommand)

function onSearchCommand(query, fs) {
   // add custom conditions to the query
   query.where.add(query.columns.orderdate.not.isNull);

   // apply the query to the foundset
   fs.loadRecords(query);
}


Regards,
Paolo

Thank you!
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 5 guests

cron