<body>
@(Html.EJ().Gantt("Gantt").
.ClientSideEvents(eve =>
{
//
eve.QueryCellInfo("queryCellinfo");
})
)
@(Html.EJ().ScriptManager())
<script type="text/x-jsrender" id="columnTemplate">
{{if #data.item.CustomField}}
<div style="display:inline-block;position:relative;left:10px;top:1px">
<img src="/Themes/gantt/{{:#data.item.CustomField}}.png" height="40px" />
</div>
<div style='display:inline-block;width:100%;position:relative;left:10px;top:-15px'>{{:#data.item.CustomField}}</div>
{{/if}}
</script>
<script type="text/javascript">
function load(args) {
//To render the custom column in Gantt
var column = this.getColumns(),
customcolumn1 = {};
customcolumn1["field"] = "CustomField";
customcolumn1["headerText"] = "Resource";
customcolumn1["isTemplateColumn"] = true;
customcolumn1["templateID"] = "columnTemplate";
column.splice(2, 0, customcolumn1);
column[1].headerText = "Customized Text";
}
function queryCellinfo(args) {
//To customize the cell value in Gantt
if (args.column.field == "CustomField" && args.data.index ==3) {
$(args.cellElement).css({ "backgroundColor": "green" });
}
}
</script> |
<body>
@(Html.EJ().Gantt("Gantt").
EnableContextMenu(true).
RowHeight(44).
ClientSideEvents(eve =>
{
eve.ContextMenuOpen("contextMenuOpen");
}).
Datasource(ViewBag.dataSource)
)
@(Html.EJ().ScriptManager())
<script type="text/javascript">
function contextMenuOpen(args) {
args.contextMenuItems.push(
{
headerText: "Custom menu",
menuId: "customMenu",
eventHandler: function (args) {
//event handler for custom menu items
alert("Custom menu");
},
});
}
</script> |
@(Html.EJ().Gantt("Gantt").
ShowColumnChooser(true).
ShowColumnOptions(true).
ClientSideEvents(eve =>
{
eve.Load("load");
}).
)
@(Html.EJ().ScriptManager())
<script type="text/javascript">
function load(args) {
var column = this.getColumns(),
//To customize the column header text
column[1].headerText = "Customized Text";
}
</script> |