Hi everyone
Is there a way I can set a default filter for the relate field in the javascript? All the examples I've seen for setting initial filter is for the PHP code only.
Thanks
Hi everyone
Is there a way I can set a default filter for the relate field in the javascript? All the examples I've seen for setting initial filter is for the PHP code only.
Thanks
Hi, Thank you for the link. I'm still having trouble after following the steps. I cannot see my filter take effect.
Am I suppose to see my newly created filter in the Dropdown list from the GUI as well or is this filter just working only in the background?
I can see my javascript code load when I put console.log messages throughout the code but its simply not filtering.
Instead of the name field I am trying to filter by account type
// JS CODE
var custom_FilterOptions = new app.utils.FilterOptions().config({
'initial_filter': 'FilterDealersTemplate',
'initial_filter_label': 'LBL_FILTER_DEALERS_TEMPLATE',
'filter_populate': {
'account_type': [this.model.get('account_type')],
}
}).populateRelate(this.model).format();
// My PHP filter definiation
$viewdefs['AVA_Account_Vehicle_Activity']['base']['filter']['basic']['filters'][] = array(
'id' => 'FilterDealersTemplate',
'name' => 'LBL_FILTER_DEALERS_TEMPLATE',
'filter_definition' => array(
array(
'account_type' => array(
'$in' => 'Dealer',
),
),
),
'editable' => true,
'is_template' => true,
);
Hi, Thank you for the link. I'm still having trouble after following the steps. I cannot see my filter take effect.
Am I suppose to see my newly created filter in the Dropdown list from the GUI as well or is this filter just working only in the background?
I can see my javascript code load when I put console.log messages throughout the code but its simply not filtering.
Instead of the name field I am trying to filter by account type
// JS CODE
var custom_FilterOptions = new app.utils.FilterOptions().config({
'initial_filter': 'FilterDealersTemplate',
'initial_filter_label': 'LBL_FILTER_DEALERS_TEMPLATE',
'filter_populate': {
'account_type': [this.model.get('account_type')],
}
}).populateRelate(this.model).format();
// My PHP filter definiation
$viewdefs['AVA_Account_Vehicle_Activity']['base']['filter']['basic']['filters'][] = array(
'id' => 'FilterDealersTemplate',
'name' => 'LBL_FILTER_DEALERS_TEMPLATE',
'filter_definition' => array(
array(
'account_type' => array(
'$in' => 'Dealer',
),
),
),
'editable' => true,
'is_template' => true,
);