Empty Swimlanes

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.

  1. It is possible to display empty swimlanes? like giving the kanban component all the swimlanes that I want to render even though some of them doesn't have any cards?
  2. How can I collapse some specific swimlanes? for example, first swimlane expanded and the rest collapsed when I open the kanban view. 
Thanks in advance

5 Replies 1 reply marked as answer

BS Buvana Sathasivam Syncfusion Team February 10, 2022 07:51 PM UTC

Hi Marco, 

Greetings from Syncfusion support. 

Query #1: “It is possible to display empty swimlanes? like giving the kanban component all the swimlanes that I want to render even though some of them doesn't have any cards?” 

Yes. It is able to achieve using sortComparer function inside the swimlaneSettings property. You can push the custom keyField and textField into already created swimlane rows and returned the sortComparer arguments. Please find the below code and sample. 

let kanbanObjKanban = new Kanban({ 
  
  swimlaneSettings: { 
    sortComparer: customSorting, 
  }, 
}); 
kanbanObj.appendTo('#Kanban'); //Render initialized Kanban control 
function customSorting(argsSortComparerFunction): void { 
  args.push({ keyField: 'empty'textField: '' }); 
  return args; 
} 



Query #2: “How can I collapse some specific swimlanes? for example, first swimlane expanded and the rest collapsed when I open the kanban view.” 

You will be able to collapse the first swimlane and expand the rest of the swimlane rows at initial rendering, like below code. 

let initialboolean = true; 
let kanbanObjKanban = 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; 
  } 
} 



Please let us know if you have any further assistance. 

Regards, 
Buvana S 


Marked as answer

MV Marco Vinaja February 14, 2022 04:57 AM UTC

Awesome, 

Thanks Buvana, that was exactly what I needed



BS Buvana Sathasivam Syncfusion Team February 15, 2022 05:18 AM UTC

Hi Marco, 

Most welcome. Please get back to us if you need any further assistance. 

Regards, 
Buvana S 



DV duy vo replied to Buvana Sathasivam August 2, 2022 04:12 PM UTC

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



BS Buvana Sathasivam Syncfusion Team August 3, 2022 04:12 PM UTC

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 kanbanObjKanban = new Kanban({

  swimlaneSettings: {

    keyField: 'RankId',

    textField: 'Assignee',

    sortComparer: customSort,

  },

});

 

function customSort(argsSortComparerFunction): SortComparerFunction {

  /* Custom Sort Function */

  args = args.slice(25); // 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




Loader.
Up arrow icon