Is it possible to enable or disable customConditions filters via the filtering API? I have several columns with customConditions defined (Example Below) but do not see any way to apply these with the API. Ex Colum Filter Definition: { columnKey: "classification", condition: "doesNotEqual", allowFiltering: true, customConditions: { Unclassified: { key: 'Unclassified', 'Unclassified', expressionText: "Unclassified", filterFunc: function (value) { return value.includes("Unclassified"); } }, ClassA: { key: 'ClassA', labelText: 'ClassA', expressionText: "AccountChanges", filterFunc: function (value) { return value.includes("ClassA"); } }, ClassB: { key: 'ClassB', labelText: 'ClassB', expressionText: "ZeroAmount", filterFunc: function (value) { return value.includes("ClassB"); } } } }
{ columnKey: "classification", condition: "doesNotEqual", allowFiltering: true, customConditions: { Unclassified: { key: 'Unclassified', 'Unclassified', expressionText: "Unclassified", filterFunc: function (value) { return value.includes("Unclassified"); } }, ClassA: { key: 'ClassA', labelText: 'ClassA', expressionText: "AccountChanges", filterFunc: function (value) { return value.includes("ClassA"); } }, ClassB: { key: 'ClassB', labelText: 'ClassB', expressionText: "ZeroAmount", filterFunc: function (value) { return value.includes("ClassB"); } } } }
Does the API offer any way for me to enable one of the above filters? I only see a way to define a new filter via the API as shown below.$("#Grid").igGridFiltering("filter", ([{ fieldName: "classification", expr: "ClassA", cond: "equal" }]), true);
$("#Grid").igGridFiltering("filter", ([{ fieldName: "classification", expr: "ClassA", cond: "equal" }]), true);
Thanks in advance!Regards,Matt
Hello Matt,
After investigating this further, I have determined that the custom filter conditions could be applied the same way as the default ones. This could be achieved by defining the custom filter and using the filter method as follows:
function applyUSAFilter(){
$("#gridCustomConditions").igGridFiltering("filter", ([{fieldName: "Country", cond: "USA", logic: "AND"}]));
}
I have created a small sample, demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
Monika, setting the "cond" to the customCondition key and omitting the "expr" field did the trick. For completeness my resulting api call is shown below.
$("#Grid").igGridFiltering("filter", ([{ fieldName: "classification", cond: "ClassB", logic: "AND" }]), true);
Regards,Matt