|
<style>
.customcolor1 {
background-color: #c65911 !important;
left: 202px;
top: 10px;
}
.customcolor2 {
background-color:#0000FF !important;
left: 202px;
top: 10px;
}
.customcolor3 {
background-color: #008000 !important;
left: 202px;
top: 10px;
}
.ganttcolorCell {
margin-left: 59px;
height: 14px !important;
width: 14px !important;
}
</style>
<ej:TreeGrid runat="server" Height="10px" ID="TreeGrid" ChildMapping="SubTasks" QueryCellInfo="queryCellInfo"
//..
<Columns>
<ej:TreeGridColumn HeaderText="✔" Field="xxxx3" AllowFreezing="true" />
<ej:TreeGridColumn HeaderText="Head5" IsTemplateColumn="true" TemplateID="colorBox">
</ej:TreeGridColumn>
</Columns>
</ej:TreeGrid>
<script>
function queryCellInfo(args) {
if (args.column.headerText == "Head5") {
if (args.data.xxxx3 == 1)
$(args.cellElement).find("div").addClass("customcolor1");
else if (args.data.xxxx3 == 2)
$(args.cellElement).find("div").addClass("customcolor2");
else if (args.data.xxxx3 == 3)
$(args.cellElement).find("div").addClass("customcolor3");
}
}
</script>
<script type="text/x-jsrender" id="colorBox">
<div class="ganttcolorCell"></div>
</script> |
|
<div id="checkBox">
<input type="checkbox" style="height:20px;width:20px" id="hideShow" /> <label>HideRow</label>
</div>
<script>
$("#hideShow").click(function (e) {
var removeRecords = [],
treeObj = $("#TreeGrid").data("ejTreeGrid"),
flatRecords = treeObj.model.flatRecords,
removeRecords = flatRecords.filter(function (record) {
return record.xxxx3 == 1
});
for (i = 0; i < removeRecords.length; i++) {
var args = [];
args.requestType = ej.TreeGrid.Actions.Delete;
args.data = removeRecords[i];
treeObj._removeRecords(args); //Method to remove the row
}
treeObj._ensureDataSource(args);
treeObj.updateHeight();
})
</script> |
|
<div id="checkBox">
<input type="checkbox" style="height:20px;width:20px" id="hideShow" /><label>HideRow</label>
</div>
<script>
var parentItemcollection = [];
$("#hideShow").click(function (e) {
e = e || window.event;
var targetEle = e.target,
checkStatus = $(targetEle).is(':checked');
var removeRecords = [],
treeObj = $("#TreeGrid").data("ejTreeGrid"),
flatRecords = treeObj.model.flatRecords;
if (!checkStatus) {
treeObj.option("dataSource", parentItemcollection);
parentItemcollection = [];
}
if (checkStatus) {
for (i = 0; i < treeObj.model.parentRecords.length; i++) {
parentItemcollection.push($.extend(true, {}, treeObj.model.parentRecords[i].item));
}
removeRecords = flatRecords.filter(function (record) {
return record.xxxx3 == 1
});
for (j = 0; j < removeRecords.length; j++) {
var args = [];
args.requestType = ej.TreeGrid.Actions.Delete;
args.data = removeRecords[j];
treeObj._removeRecords(args); //Method to remove the row
}
treeObj._ensureDataSource(args);
treeObj.updateHeight();
}
})
</script> |