Category / Section
How to set color for a particular cell in PivotGrid?
1 min read
This KB illustrates that how to set color for a specific cell in PivotGrid.
Solution:
You can set color for a specified cell in PivotGrid by using the following code examples at sample level.
JavaScript
$("#PivotGrid1").ejPivotGrid({ url: "../wcf/PagingService.svc"}); $("#Button1").ejButton({ size: "normal", click:"btnClick" }); function btnClick(args) { $("#PivotGrid1 table td")[2].style["background-color"] = "yellow"; $("#PivotGrid1 table td")[5].style["background-color"] = "red"; return false; }
ASP
<ej:PivotGrid ID="PivotGrid1" Url="../wcf/PagingService.svc" runat="server"></ej:PivotGrid> <ej:Button ID="Button1" runat="server" Size="Large" Type="Reset" OnClick="btnClick" ShowRoundedCorner="true" Text=" Click Here…"></ej:Button> function btnClick(args) { $("#PivotGrid1 table td")[2].style["background-color"] = "yellow"; $("#PivotGrid1 table td")[5].style["background-color"] = "red"; return false; }
MVC
@Html.EJ().Pivot().PivotGrid("PivotGrid1").Url(Url.Content("~/wcf/PagingService.svc")) @Html.EJ().Button("Button1").Text("Click Here …").Size(ButtonSize.Normal).ShowRoundedCorner(true).ClientSideEvents(e => e.Click("btnClick")) function btnClick(args) { $("#PivotGrid1 table td")[2].style["background-color"] = "yellow"; $("#PivotGrid1 table td")[5].style["background-color"] = "red"; return false; }