I'm trying to set default sorting order in camunda tasklist filter to asc by created date.
Found only this suggestion which says that I should use maven replacer plugin. But I would like to make it more elegant way. For example for tasklist localization I created file src/main/resources/META-INF/resources/webjars/camunda/app/tasklist/scripts/config.js
.
I have web camunda with spring: org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:3.4.2
Added file PROJECT_DIR/src/main/resources/META-INF/resources/webjars/camunda/app/tasklist/scripts/defaultSorting.js
define(['angular'], function (angular) {
var ngModule = angular.module('tasklist.defaultSorting', []);
ngModule.config(['ViewsProvider', function (ViewsProvider) {
ViewsProvider.registerDefaultView('tasklist.header', {
id: 'default-sorting',
priority: 50,
template: "<script>angular.element(document.getElementsByClassName('sorting-choice')).scope().changeOrder(0)</script>"
});
}]);
return ngModule;
});
which set order needed order while loading of TaskList page.
To enable functionality in file you need to add customScripts in PROJECT_DIR/src/main/resources/META-INF/resources/webjars/camunda/app/tasklist/scripts/config.js:
var camTasklistConf = {
"locales": {
"availableLocales": ["ru"],
"fallbackLocale": "ru"
},
app: {
name: 'App',
vendor: 'Vendor'
},
customScripts: {
ngDeps: ['tasklist.defaultSorting'],
deps: ['defaultSorting'],
paths: {
'defaultSorting': 'scripts/defaultSorting'
}
}
};
Related documentation: https://docs.camunda.org/manual/latest/webapps/cockpit/extend/configuration/#custom-scripts