|
<ej-kanban id="KanbanBoard" key-field="Status" dataSource="ViewBag.datasource" create="onCreate">
<e-kanbanfield content="Summary" primary-key="Id">
</e-kanbanfield>
</ej-kanban>
<script>
function onCreate(e) { //create event
var columnsData = [];
var colsData = @Json.Serialize(ViewBag.ProposalKanbanStatusColumns);
for (var i = 0; i < colsData.length; i++) {
columnsData.push({ headerText: colsData[i]['HeaderText'], key: colsData[i]['Key'], allowDrag: colsData[i]['AllowDrag'], allowDrop: colsData[i]['AllowDrop'] }); // set the allowDrag and allowDrop property to your column
}
$("#KanbanBoard").ejKanban({ columns: columnsData }); //assign to columns property
}
</script>
Controller:
//set value to your columns
List<Tasks1> Task1 = new List<Tasks1>();
Task1.Add(new Tasks1() { HeaderText = "Open", Key = "Open", AllowDrag = true, AllowDrop = true });
Task1.Add(new Tasks1() { HeaderText = "InProgress", Key = "InProgress", AllowDrag = true, AllowDrop = true});
Task1.Add(new Tasks1() { HeaderText = "Validate", Key = "Validate", AllowDrag = false, AllowDrop = false});
Task1.Add(new Tasks1() { HeaderText = "Done", Key = "Close", AllowDrag = true, AllowDrop = true });
|
|
<ej-button id="btn" text="Cilck to change" width="100px" click="onClick" />
<script>
function onClick(e) { // button click
var kanbanobj = $("#KanbanBoard").ejKanban("instance"); // take the Kanban instance
var newcolumns = kanbanobj.model.columns; // take the Kanban columns model using the instance
newcolumns[1].allowDrag = false; // through the columns object change the allowdrag or drop model value dynamically
newcolumns[1].allowDrop = false;
$("#KanbanBoard").ejKanban({ columns: newcolumns }); // then again set the entire columns via setmodel
}
</script>
|