We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Some questions

Hello.

I have some questions regarding the Kanban control.
I´m using JavaScript (typescript) and as asp.net backend (I´m not using the syncfusion asp.net mvc controls!)

The client side code looks like this...

self.dataManager = new ej.DataManager({
                url: "http://myurl",
                adaptor: new ej.UrlAdaptor(),
                crossDomain: true
            });

self.kaban = $("#kanban").ejKanban({
 dataSource: self.dataManager,
columns: [{ headerText: "Ablauf", key: "Stages"}],
keyField: "KanbanKey",
fields: {
primaryKey: "KanbanId",
content: "KanbanContent"
},.....

like in your samples.

I have the following questions:

1. 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?
2. If I cant prevent this, is there a chance to get the new order of items in one column?
3. Can I prevent one item of being dragged?
4. 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)
5. How can one query the current order of items in one column.

Thank you very much for your help!

All the best,
Florian




6 Replies

KN Kavitha Narayanan Syncfusion Team July 29, 2016 06:46 PM UTC

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. 



FM Florian Mihalits August 2, 2016 10:47 AM UTC

Your answers helped me a lot.
Thank you!

All the best,
Florian


KN Kavitha Narayanan Syncfusion Team August 3, 2016 04:41 AM UTC

Hi Florian,

Thanks for your update.

Please let us know if you need any further assistance.

Regards,  
Kavitha N.  



FM Florian Mihalits August 3, 2016 04:46 AM UTC

Hello Kavitha.

Yes, one question remains:
Is there a way to change the URL (method) that is being called for the batch update by the datamanager?
I.e. my URL for remote binding ist "getStages". I would like to call "updateStages" for the batch update. Is this possible?

Thank you again for your help,
Florian


FM Florian Mihalits August 3, 2016 08:52 AM UTC

Hello.

I found this article: https://www.syncfusion.com/kb/3013/how-to-change-the-url-action-path-for-the-grid-crud-operations
Question answered. Thanks.

All the best, Florian


KN Kavitha Narayanan Syncfusion Team August 4, 2016 10:17 AM UTC

Hi Florian, 
 
Thanks for your update. 
 
We are happy to hear from you again. 
 
We suspect that you are using Grid batch update and it has been resolved through KB link. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Kavitha N. 
 


Loader.
Up arrow icon