I tried to hide a filter and found a problem.
To hide a filter you need first to change the on_filter_form_created event handler in the task client module.
function on_filter_form_created(item) {
item.filter_options.title = item.item_caption + ' - filters';
item.filter_form.find("#cancel-btn").on('click.task', function() {
item.close_filter_form();
});
item.filter_form.find("#ok-btn").on('click.task', function() {
item.set_order_by(item.view_options.default_order);
item.apply_filters(item._search_params);
});
if (!item.master && item.owner.on_filter_form_created) {
item.owner.on_filter_form_created(item);
}
if (item.on_filter_form_created) {
item.on_filter_form_created(item);
}
item.create_filter_inputs(item.filter_form.find(".edit-body"));
return true;
}
After this change the following code in the invoices client module of the demo app will work and hide the customer filter.
function on_filter_form_created(item) {
item.filters.customer.visible = false;
}