Is there a way to remove the addIcon from showAddButton and append dynamic text like `View {column_name} Jobs` to queryCellInfo and also placing the button at the last part of the card list.
Something like this in Jira. Attached below
<KanbanComponent id="kanban" ref={(kanban) => { kanbanObj = kanban; }} keyField="Status" dataBound={dataBound} dataSource={data} cardSettings={{ contentField: 'Summary', headerField: 'Id' }} > </KanbanComponent> function dataBound() { if (firstRender) { const contentRows = kanbanObj.element.querySelectorAll('.e-content-row'); let i = 0; contentRows.forEach((contentRow, index) => { if (!contentRow.classList.contains('e-swimlane-row')) { [].slice.call(contentRow.children).forEach((cell) => { const element = document.createElement('button'); element.className = 'e-btn'; element.innerHTML = 'View ' + cell.dataset.key + ' Jobs'; cell.appendChild(element); element.onclick = function () { addClick(cell.dataset.key); }; }); } }); firstRender = false; } function addClick(status) { const cardIds = kanbanObj.kanbanData.map((obj) => parseInt(obj.Id.replace('Task ', ''), 10) ); const cardCount = Math.max.apply(Math, cardIds) + 1; const cardDetails = { Id: 'Task ' + cardCount, Status: status, Priority: 'Normal', Assignee: 'Andrew Fuller', Estimate: 0, Tags: '', Summary: '', }; kanbanObj.openDialog('Add', cardDetails); } } |
Is there a way to style the button and make it responsive? I was looking at the sample demo code when i resize the screen its overlaps and not responsive to the column width size. And also conditionally render the button when column exceeds 30 cards.
I also notice some bugs with the code whenever i drag and drop cards to another column the button goes to the top of the cards and it appends another button. Attached photo below.
Attachment: Screen_Shot_20230417_at_5.38.57_PM_3e9e24d1.zip
.e-custom { width: 290px; } contentRows.forEach((contentRow, index) => { if (!contentRow.classList.contains('e-swimlane-row')) { [].slice.call(contentRow.children).forEach((cell) => { const element = document.createElement('button'); element.className = 'e-btn e-custom'; element.innerHTML = 'View ' + cell.dataset.key + ' Jobs'; cell.appendChild(element); element.onclick = function () { addClick(cell.dataset.key); }; }); } }); |
function dataBound() { if (firstRender) { const contentRows = kanbanObj.element.querySelectorAll('.e-content-row'); let i = 0; contentRows.forEach((contentRow, index) => { if (!contentRow.classList.contains('e-swimlane-row')) { [].slice.call(contentRow.children).forEach((cell) => { if (cell.childNodes[1].childElementCount >= 30) { const element = document.createElement('button'); element.className = 'e-btn e-custom'; element.innerHTML = 'View ' + cell.dataset.key + ' Jobs'; cell.appendChild(element); element.onclick = function () { addClick(cell.dataset.key); }; } }); } }); firstRender = false; } ..... ....... } |
Thanks for the response. I used another approach instead. Upon deep checking i stumbled upon this 'created' prop from kanbanComponent(since i think this one make more sense the description says its going to be trigger when kanban component is created) but when I tried to use this one I noticed that sometimes it wont execute/trigger my function and the text displays on the top. May I know the right way of using this one.