Hi,
I am integrating Syncfusion kanban to Odoo, everything is working fine but I just need 2 functionalities that I don't know how to implement.
|
let kanbanObj: Kanban = new Kanban({
swimlaneSettings: {
sortComparer: customSorting,
},
});
kanbanObj.appendTo('#Kanban'); //Render initialized Kanban control
function customSorting(args: SortComparerFunction): void {
args.push({ keyField: 'empty', textField: '' });
return args;
}
|
|
let initial: boolean = true;
let kanbanObj: Kanban = new Kanban({
dataBound: dataBound,
});
function dataBound(): void {
if (initial) {
for (
var i = 1;
i < document.querySelectorAll('.e-swimlane-header .e-item-count').length;
i++
) {
(
document
.querySelectorAll('.e-swimlane-header')
[i].querySelector('.e-icons') as HTMLDivElement
).click();
}
initial = false;
}
}
|
Awesome,
Thanks Buvana, that was exactly what I needed
Hi Buvana,
In this example https://ej2.syncfusion.com/demos/#/bootstrap5/kanban/swimlane.html, we can sort Swimlane by Ascending or Descending. Can we use sortComparer to do the custom sorting?
For example, I have
swimlaneSettings: { keyField: 'Assignee', sortField: 'Rank'}
I would like to sort by Rank field.
Thank and best regards,
DuyVT
Hi Duy,
Yes, you can use the custom sort compare function to arrange the swimlane rows as per your wish. In the below sample, we have rendered 3 swimlane rows in the set of 6 swimlane rows and also used the RankId mapping field into keyField property. Please find the below code for your reference.
Index.ts
|
let kanbanObj: Kanban = new Kanban({ swimlaneSettings: { keyField: 'RankId', textField: 'Assignee', sortComparer: customSort, }, });
function customSort(args: SortComparerFunction): SortComparerFunction { /* Custom Sort Function */ args = args.slice(2, 5); // Here, you can re-arrange the swimlane rows as per your wish return args; } |
Sample: https://stackblitz.com/edit/jwrrgu-bxgp1g?file=index.ts
Regards,
Buvana S