EJ2 Kanban - Adding Query after the fact messes up Kanban

So we have a basic Kanban:

var dataManager = new ej.data.DataManager({
url: '/api/tasks',
crudUrl: '/api/tasksCrud',
adaptor: new ej.data.UrlAdaptor(),
crossDomain: true,
headers: [{"Authorization": "Bearer {{Auth::User()->api_token}}"}]
});
var swimLane = {
keyField: 'user_id',
textField: 'fName'
};

var kanban = new ej.kanban.Kanban({
dataSource: dataManager,
keyField: 'status',
columns: [
{ headerText: 'Open', keyField: 'Open' },
{ headerText: 'In Progress', keyField: 'InProgress' },
{ headerText: 'On Going', keyField: 'OnGoing' },
{ headerText: 'Completed', keyField: 'Completed' }
],
cardSettings: {
contentField: 'details',
headerField: 'summary'
},
// swimlaneSettings: swimLane,
enableTooltip: true,
tooltipTemplate: '#tooltipTemplate',
dialogSettings: {
template: '#dialogTemplate',
model: {
height: 700,
width: 1000,
isModal: true,
allowDragging: true,
closeOnEscape: true,
enableResize: true
}
},
dialogOpen: onDialogOpen,
actionFailure: actionFailure
});
kanban.appendTo('#Kanban');


It loads fine, but when we add Query after the fact, it gets all messed up like in the attached.

kanban.query = new ej.data.Query().addParams('my_task', 1);

Also, is it possible to toggle swimlane on and off?  I am trying this way - which works when you add it the first time, but you can't take it away as nothing happens.

function menuSelected(args){
switch(args.item.properties.text){
case 'With User Groups':
kanban.swimlaneSettings = swimLane;
break;
case 'Without User Groups':
//This isn't working. Will need to post
kanban.swimlaneSettings = {};
break;
}
}

Attachment: Pictures_acb58229.zip

3 Replies 1 reply marked as answer

VD Vinitha Devi Murugan Syncfusion Team August 3, 2020 11:30 AM UTC

Hi Mark,

Syncfusion Greetings. 

Q1: We tried to reproduce your reported scenario at our end, but the query property working fine at our end. We have prepared the below sample for your reference.  Kindly try the below sample and if still issue persists, try to reproduce the issue in the above sample and revert. 


Q2: Yes, it is possible to toggle swimlane on and off by making use of below code.

function change(args) {
  if (args.value == "swimlane") {
    kanbanObj.swimlaneSettings = swimLane;
  } else {
    kanbanObj.swimlaneSettings.keyField = null;
  }
}

Regards,
M.Vinitha devi


Marked as answer

MA Mark August 4, 2020 12:11 AM UTC

Thank you.  I will implement this immediately and let you know.  Regarding the query, when the query is added up front, it works, its when its added after the fact.  I have forked your blitz to demonstrate.  In the blitz, it does nothing:  https://stackblitz.com/edit/kanban-query-ad-swimlane-ozgybp?file=index.js

Edit: Setting the keyfield to null worked great!

Final Edit:  We got it figured out.  Running kanban.refresh() after adding the query was causing the issue.  Removing that and everything works ok.


VD Vinitha Devi Murugan Syncfusion Team August 4, 2020 08:45 AM UTC

Hi Mark,

Thanks for your update.

We are happy that your problem is solved by our solution. We'll wait to hear from you about the query issue.

Regards,
M.Vinitha devi


Loader.
Up arrow icon