Please help how to add custom filter (checkbox) in activities section by code
I really need to solve this question , even a part of them
-Create new filter “Attention” in the Activity section grid page (near Owner and Date filters). When turned on, only overdue activities and high priority
today activities should be displayed. Filter should use current user time zone.
(using code and not filter manually)
Like
In ActivitySectionV2 do it by analogy with this example
1) Create new filter near Owner and Date filters
{
"operation": "insert",
"parentName": "IsActiveFiltersContainer",
"propertyName": "items",
"name": "IsActiveCheckbox",
"values": {
"bindTo": "IsActive",
"caption": "Активные",
"controlConfig": {
"className": "Terrasoft.CheckBoxEdit",
"checkedchanged": {
"bindTo": "onIsActiveCheckboxChecked"
}
}
}
}
2)
getFilters: function () {
var sectionFilters = this.callParent(arguments);
this.setIsActiveFilter(sectionFilters);
//this.setCommunicationFilter(sectionFilters);
return sectionFilters;
},
setIsActiveFilter: function (filterCollection) {
var isActive = this.get("IsActive");
if (isActive) {
if (!filterCollection.contains("IsActiveFilter")) {
filterCollection.add("IsActiveFilter", this.Terrasoft.createColumnIsNullFilter("Account"));
}
} else {
filterCollection.removeByKey("IsActiveFilter");
}
},
onIsActiveCheckboxChecked: function (value) {
if (!this.get("IsSectionVisible")) {
return;
}
this.set("IsActive", value);
this.sandbox.publish("FiltersChanged", null, [this.sandbox.id]);
this.reloadGridData();
},
3)Add atribute "IsActive"
attributes: {
"IsActive": {
"dataValueType": this.Terrasoft.DataValueType.BOOLEAN,
"type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"value": true
},
}
}
Hello!
Please see a comment from Grigoriy above, this would help you implement your idea.
Matt