[aspx]
<ej:Gantt ID="Ganttcontainer" runat="server" Load="load">
</ej:Gantt>
<script>
var dropDownDatasource = [
{ id: 1, text: "Value1", value: "Value1" },
{ id: 2, text: "Value2", value: "Value2" },
{ id: 4, text: "Value3", value: "Value3" },
{ id: 5, text: "Value4", value: "Value4" },
{ id: 6, text: "Value5", value: "Value5" },
{ id: 7, text: "Value6", value: "Value6" },
{ id: 8, text: "Value7", value: "Value7" }
];
function load(args) {
//To load the custom columns in Gantt
var column = this.getColumns(),
progressfield = {},
customField = {
field: "customColumn1",
mappingName: "customColumn1",
headerText: "Custom Column",
dropdownData: dropDownDatasource,
editType: "dropdownedit",
editParams: { fields: { text: "text", value: "value" } },
};
column.splice(2, 0, customField);
}
</script>
[aspx.cs]
data.Add(new SelfData()
{
Id = 1,
Name = "Parent Task 1",
StartDate = "02/23/2014",
Duration = 5,
PercentDone = 40,
customColumn1="Value1",
ParentId = null
}); |
<ej:Gantt ID="Ganttcontainer" runat="server"
Create="create">
</ej:Gantt>
<script>
function create(args) {
var toolbar = $("#Ganttcontainer_toolbarItems");
//Toolbar item to be added
var toolbarItem = "<li><button title=" + "reload" + " class=" + "e-tooltxt " + " id=" + "Ganttcontainer_customicon" + " style=width:37px;height:20px;" + "><span id=customicon" + "></span>Reload</button></li>";
//appending the new item to the existing toolbar
$($(toolbar).children()).append(toolbarItem);
$("#Ganttcontainer_customicon").click(function () {
alert("We can bind custom action to Toolbar here")
})
}
</script> |