After using setFilterValue multiple times it doesn’t seem to properly apply. I’m not sure why it’s doing this.
I created an example solution for this but I can't post it on the forums. Will be attached to a support ticket later.
METHOD
I have a class that contains the toolbar filter itself. This contains the functions to add and set filter values.
I extend this onto a grid form, which updates the set value for each added filter by clicking on buttons I made.
PROBLEM
When I click on my custom buttons to change the set value for a filter, the results will just be wrong.
- Duplicate records will appear
- Records with incorrect value related to the filter will appear
Though, searching some text and then changing the filter seems to fix it. But, when I tried to add even that programmatically it didn't help. Something is just not working and I do not know why!
Any help is appreciated!
CODE
class.js
- Code: Select all
/**
* @param {String} Text
* @param {String} Provider
* @param {String} Type
*
* @public
*
* @return {Filter}
*
* @properties={typeid:24,uuid:"A09E378C-D905-43C7-AA9F-D375D958046B"}
*/
function add_toolbarFilter( Text, Provider, Type ) {
var filter = toolbarFilter.addFilter( Text, Provider, Type )
// application.output( filter )
return filter
}
/**
* @param {Filter} Filter
* @param {Array} Value
* @param {String} Operatr
*
* @public
*
* @properties={typeid:24,uuid:"4183AD40-079A-428C-9D9C-7B696171725A"}
*/
function set_toolbarFilter( Filter, Value, Operatr ) {
toolbarFilter.setFilterValue( Filter, Value, Operatr )
}
grid.js
- Code: Select all
/**
* @properties={typeid:24,uuid:"8AC2CB6C-FFB5-426D-9780-0D189DFD3005"}
*/
function ini_filtering() {
var f_archive = add_toolbarFilter( 'archival', 'archive', scopes.svyToolbarFilter.FILTER_TYPES.INTEGER )
set_toolbarFilter( f_archive, [0], scopes.svyPopupFilter.OPERATOR.EQUALS )
filter_Archive = f_archive
var f_type = add_toolbarFilter( 'type', 'type', scopes.svyToolbarFilter.FILTER_TYPES.INTEGER )
set_toolbarFilter( f_type, [], scopes.svyPopupFilter.OPERATOR.NOT_NULL )
filter_Type = f_type
}
/**
* @public
*
* @properties={typeid:24,uuid:"090D915F-A6E2-42F1-8C5C-268FF02EBB13"}
*/
function update_filterArchive( Type ) {
// reset
// set_toolbarFilter( filter_Archive, [], scopes.svyPopupFilter.OPERATOR.EQUALS )
switch( Type )
{
case scopes.Filter.def_Archive.current:
set_toolbarFilter( filter_Archive, [0], scopes.svyPopupFilter.OPERATOR.EQUALS )
break;
case scopes.Filter.def_Archive.archived:
set_toolbarFilter( filter_Archive, [1], scopes.svyPopupFilter.OPERATOR.EQUALS )
break;
case scopes.Filter.def_Archive.all:
set_toolbarFilter( filter_Archive, [], scopes.svyPopupFilter.OPERATOR.EQUALS_OR_NULL )
break;
default:
}
reset_search()
reset_search()
// foundset.reloadWithFilters()
}
/**
* @public
*
*
* @properties={typeid:24,uuid:"AC7119E9-2ABD-481E-A992-87C68B1CD273"}
*/
function update_filterType( Type ) {
// reset
// set_toolbarFilter( filter_Type, [], scopes.svyPopupFilter.OPERATOR.NOT_NULL )
switch( Type )
{
case scopes.Filter.def_Type.all:
set_toolbarFilter( filter_Type, [], scopes.svyPopupFilter.OPERATOR.NOT_NULL )
break;
case scopes.Filter.def_Type.car:
set_toolbarFilter( filter_Type, ['car'], scopes.svyPopupFilter.OPERATOR.LIKE )
break;
default:
}
reset_search()
}