I have designed one page where i am showing some actions using command. But i want to change the icons based on condition suppose based on status,
As mentioned in attached picture for OnHold the icons are displaying as edit, Cancel and OnHold but for approved we need to show only edit and cancel.
How we can achieve that? Also ,the command actions is taking a square block instead of that i need to show only font awesome icons like in second attached picture
Please help.
Thanks & Regards
Manish Tiwari
Below is the code: -
<script>
var dataSource1 =
$(document).ready(function () {
var element = $("#grid").kendoGrid({
dataSource: new kendo.data.DataSource({
data:@Html.Raw(Json.Serialize(Model.RequestViewModel)),
dataType: JSON,
pageSize: 10
}),
height: 500,
sortable: true,
pageable: true,
reorderable: true,
resizable: true,
filterable: true,
detailInit: detailInit,
columns: [
{
field: "RequestId",
title: "Request Id",
width: "115px"
},
{
field: "Priority",
width:"100px"
},
{
field: "RequestName",
title: "Request Name",
width: "150px"
},
{
field: "RequestDate",
title: "Request Date",
width: "150px"
},
{
field:"Department",
title: "Dept",
width:"110px"
},
{
field: "Role",
title:"Role",
width: "100px"
},
{
filed: "PositionFilled",
title: "Position Filled",
width:"120px"
},
{
field:"RequestStatus",
title: "Status",
width: "120px"
},
{
field: "RequestStage",
title: "Stage",
width: "120px",
},
{
command: [
{ name: "edit", text: " ", iconClass: "fa fa-pencil" }, { name: "cancel", text: " ", iconClass: "fa fa-times fa-fw" }, {
name: "hold", text: "  ", iconClass: "fa fa-hand-paper-o", click: function (e) {
var tr = $(e.target).closest("tr");
var data = this.dataItem(tr);
putOnHoldPopup(data.RequestId);
} }
], width: "250px"
}
],
});
}).data("kendoGrid");
function detailInit(e) {
debugger;
var p = e.data.RequestId;
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: new kendo.data.DataSource({ data:@Html.Raw(Json.Serialize(Model.RequestTimeline)), dataType: JSON }),
serverPaging: true,
serverSorting: true,
pageSize: 10,
filter: { field: "RequestId", operator: "eq", value: parseInt(p) },
columns: [
{ field: "RecordedTime", width: "110px" },
{ field: "ByWhom", title: "By", width: "110px" },
{ field: "Message", title: "Message" },
{ field: "Comment", title: "Comment", width: "300px" }
]
});
}
</script>