set the default parameters for data filtering in jqadm
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
set the default parameters for data filtering in jqadm
How can I set the default parameters for data filtering in jqadm for product?
[img]https://a.radikal.ru/a17/1808/e1/52a1e2a00ef8.png
[/img]
[img]https://a.radikal.ru/a17/1808/e1/52a1e2a00ef8.png
[/img]
Re: set the default parameters for data filtering in jqadm
I find solution to my problem:
But maybe there is another way to solve the problem, more correct?
Code: Select all
$params = $this->storeSearchParams( $view->param(), 'product' );
/* Check or set default value for filter product.status*/
$filterKeys = $view->param('filter/key', []);
$searchKey = array_search('product.status', $filterKeys);
$filterVal = $view->param('filter/val', []);
if(!isset($filterVal[$searchKey]) || empty($filterVal[$searchKey])){
$defaultFilter = array(
'filter' => array(
'key' => array( 2 => 'product.status' ),
'op' => array( 2 => '==' ),
'val' => array(2 => 1 ),
));
$params = $this->storeSearchParams( $defaultFilter , 'product' );
}
But maybe there is another way to solve the problem, more correct?