sets a filter for a particular field
id | id | the id of a field |
value | object | the filter configuration object |
// setting a filter for a field with string values
pivot.setFilterValue("name",{
operation:"ct",
filter:"a",
values:["Argentina","Australia"]
});
// setting a filter for a field with number values
pivot.setFilterValue("year",{
operation:"gt"
filter:"2005",
values:[2006]
});
// setting a filter for a field with date values
pivot.setFilterValue("when",{
filter:{from:"01.03.2012",to:"01.05.2012"},
values:[1336078800000]
});
The filter configuration object contains the following properties:
Note that there are some important points in setting filters for fields that work with date values.
pivot.setFilterValue("when",{
filter:{from:"01.03.2012",to:"01.05.2012"},
values:[1336078800000]
});
fieldList: [
{ id: "name", label: "Name" },
{ id: "year", label: "Year", type: "number" },
{ id: "when", label: "When", type: "date",
format: "%d/%m/%Y", inputFormat: "%d.%m.%Y" }
// more fields
]
The setFilterValue() method also allows you to remove a particular filter by passing an empty object as a second parameter:
pivot.setFilterValue("name",{});