I am using code first Entity framework C# and MVC 5, these fields should use Json data from a controller to populate list boxes.
Thanks in advance
Edmund Herbert
[View]
@(Html.EJ().Gantt("ganttsample2")
//
.ClientSideEvents(eve =>
eve.Load("load"))
)
<script>
function load(args) {
//To render the custom column for JobNumber
var col_collection = this.getColumns();
var column1 = {}, column2 = {}, drop_data;
column1["editType"] = "dropdownedit";
column1["field"] = "JobNumber";
column1["headerText"] = "JobNumber";
column1["mappingName"] = "JobNumber";
column1["editParams"] = { fields: { text: "JobNumber", value: "JobNumber" } };
//ajax to call the server method and to retrieve the data to client side
$.ajax({
url: '@Url.Action("GetData", "Gantt")',
async: false,
type: "GET",
success: function (result) {
drop_data = result;
},
error: function () {
alert('A error');
}
});
column1["dropdownData"] = drop_data;
col_collection.splice(1, 0, column1);
//To render the custom column for Task
column2["editType"] = "dropdownedit";
column2["field"] = "Task";
column2["width"] = "250px";
column2["headerText"] = "Task";
column2["mappingName"] = "Task";
column2["dropdownData"] = drop_data;
column2["editParams"] = { fields: { text: "Task", value: "Task" } };
col_collection.splice(1, 0, column2);
}
</script> |