How to display the hierarchy name instead of dimension name in SplitButton for ASP.NET MVC PivotClient?
You can display the name of the hierarchy, instead of the dimension name in SplitButton inside the AxisElementBuilder of OLAPClient using the following code example.
JS
<script type="text/javascript"> $(function () { $("#OlapClient1").ejOlapClient({ url: "../wcf/OlapClientService.svc", title: "OLAP Browser", renderSuccess: "onRenderControlSuceess" }); }); function onRenderControlSuceess(args) { for (var i = 0; i <= $(".splitBtn").length; i++) { if ($(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title") != "Measures") { Title = $(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title"); Text = Title.split("-")[1]; $(args.element).find(".splitBtn:eq(" + i + ")").children().text(Text); } } } </script>
MVC
@Html.EJ().Olap().OlapClient("OlapClient1").Url("../wcf/OlapClientService.svc").Title("OLAP Browser").ClientSideEvents(oEve => { oEve.RenderSuccess("onRenderControlSuceess"); }) <script> function onRenderControlSuceess(args) { for (var i = 0; i <= $(".splitBtn").length; i++) { if ($(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title") != "Measures") { Title = $(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title"); Text = Title.split("-")[1]; $(args.element).find(".splitBtn:eq(" + i + ")").children().text(Text); } } } </script>
ASP.NET
<ej:OlapClient ID = "OlapClient1" runat = "server" Url= "../wcf/OlapClientService.svc" Title= "OLAP Browser"> <ClientSideEvents RenderSuccess = "onRenderControlSuceess" /> </ej:OlapClient> <script> function onRenderControlSuceess(args) { for (var i = 0; i <= $(".splitBtn").length; i++) { if ($(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title") != "Measures") { Title = $(args.element).find(".splitBtn:eq(" + i + ")").children().attr("title"); Text = Title.split("-")[1]; $(args.element).find(".splitBtn:eq(" + i + ")").children().text(Text); } } } </script>
Conclusion
I hope you enjoyed learning about how to display the hierarchy name instead of dimension name in SplitButton for ASP.NET MVC PivotClient.
You can refer to our ASP.NET MVC Pivot Client feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC Pivot Client example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!