Hi Florian,
Thank you for contacting Syncfusion support.
Query #: Everytime a drag and drop operation occures your control makes a request to the backend containing changed, addedd and deleted items. How can I prevent the Kanban control doing so?
In remote binding for any data update, post will send to server to update the values in Data source. Whether your requirement is to send bulk updates to server once all the editing of card done ( updated, added, edited all cards) ? Could you please explain your query briefly about the real time scenario so that we can analyze based on that and provide you better solution.
Query #: If I can’t prevent this, is there a chance to get the new order of items in one column?
We suspect that your requirement is to add all newly added cards into single column. In that case, we use defaultValue property inside of edititems for setting default value to particular column field for adding a new card. For example, if you are using defaultValue as open for Status field which is mapped for column keyfield, then every time status filed as open in the newly added card.
Please refer to the code and UG documentation.
keyField: "Status",
editSettings: {
editMode: ej.Kanban.EditMode.Dialog,
editItems: [
{ field: "Id", editType: ej.Kanban.EditingType.String },
{ field: "Status", editType: ej.Kanban.EditingType.String, defaultValue: "Open" },//set default value to Status field
{ field: "Assignee", editType: ej.Kanban.EditingType.String },
{ field: "Summary", editType: ej.Kanban.EditingType.TextArea }],
allowEditing: true,
allowAdding: true
}, |
Query #: Can I prevent one item of being dragged?
We used cardDragStart clientside event to prevent the card from dragging with the help of below code. We have applied card drag restriction to the card which is having primary key as “7”.
cardDragStart: "carddragstart",
function carddragstart(args) {
if (args.data[0][0].Id == "7")//condition checked based on primary key
args.cancel = true;//set prevent drag card
} |
Query #: How can I make sure, that the very first item in a column remains the first item (no item can be dragged before the first item)
We can maintain priority of cards based on `priority` field mapping to some Data source column. Here we have mapped `priority` property to DB column “RankId” and “RankId” with value 1 will be listed in top of columns. To prevent dragged before the first item,we used “cardDragStop” event where we have found the target clone element from args.dropTarget. Please refer to the code.
fields: {
primaryKey: "Id",
content: "Summary",
priority: "RankId"
},
cardDragStop: "carddragstop",
function carddragstop(args) {
var frstClone = $($(args.dropTarget).closest(".e-rowcell").find("div:first-child:eq(0)"));
if (frstClone.hasClass("e-targetclone"))
{
args.cancel = true;
frstClone.remove();// remove clone element if before the first item
}
} |
Query #: How can one query the current order of items in one column.
We can get the particular column items order using column key values. Please use the below code to get current order of items in one column.
Please share more details about the issue if we misunderstood your query. Based on that, we can analyze and provide better solution.
var kanbanObj = $("#kanban").data("ejKanban")
ej.DataManager(kanbanObj.currentViewData).executeLocal(ej.Query().where(kanbanObj.model.keyField, "equal", kanbanObj.model.columns[0].key))
|
Please refer to the sample.
Let us know if you have other queries.
Regards,
Kavitha N.