I have two questions here.
My datasource is status JSON for the data. When I move a card, I'd like to update the value of all of the cards affected via a URL (ex: pass ID, column and position in column)
I have tried adding cardSettings-Priority with the value being a numeric field that is distinct to the column. My JSON data is sorted by column by priority value, however when the cards render the order is not the same. It doesn't match what I'd expect with the Priority field.
I do understand that I can sort using
kanbanObj.sortSettings.sortBy = 'Custom';
kanbanObj.sortSettings.field = 'OrderPress';
kanbanObj.sortSettings.direction = 'Ascending';
However then I still have the issue with changing values for all of the JSON data and doing a refresh. I'd prefer to not have to refresh, but just update via a URL so the backend matches the frontend.
As I explained above, I had no custom sort and just the Priority but that did not work - the order was what appeared to be random. So I had tried adding the sort but wanted to use native functions.
Again, I have two questions. I need to show cards in the correct order by default. Secondly, I need to know which card positions have changed after a card is moved.
I can email you source as well. Please LMK where to send.
let kanbanObj: Kanban = new Kanban({ //Initialize Kanban control dataSource: data, keyField: 'Status', columns: [ { headerText: 'To Do', keyField: 'Open' }, { headerText: 'In Progress', keyField: 'InProgress' }, { headerText: 'Done', keyField: 'Close' }, ], cardSettings: { headerField: 'Id', contentField: 'Summary', template: '#cardTemplate', }, sortSettings: { sortBy: 'Index', field: 'RankId', }, dragStop: dragStop, }); kanbanObj.appendTo('#Kanban'); //Render initialized Kanban control function dragStop(args) { console.log(args.data[0]); } |
Thank you for the reply. For #1, I will need to test again. For #2 - I want to get ALL of the card positions that changed after the drag as the RankId for several would change if I moved a card up or down or across columns... those new positions need to get updated for the raw data.
let kanbanObj: Kanban = new Kanban({ //Initialize Kanban control dataSource: data, keyField: 'Status', columns: [ { headerText: 'To Do', keyField: 'Open' }, { headerText: 'In Progress', keyField: 'InProgress' }, { headerText: 'Done', keyField: 'Close' }, ], cardSettings: { headerField: 'Id', contentField: 'Summary', template: '#cardTemplate', }, sortSettings: { sortBy: 'Index', field: 'RankId', }, actionComplete: actionComplete, }); kanbanObj.appendTo('#Kanban'); //Render initialized Kanban control function actionComplete(args): void { if (args.requestType == 'cardChanged') { console.log(args.changedRecords); } } |
When I look at the console, I only see data for one moved card. For example, if I have 1 card in column1 and 2 cards in column 2, and i drop the card from 1 to the TOP of 2, I would expect to see log entries for THREE cards.
I can see how it's working for you, but I only see the one event logged. I do also have an
OnDragStop event triggered - maybe that is causing conflict with cardChanged?