Articles in this section
Category / Section

How to hide check boxes and context menu in .NET Web Forms PivotGrid?

3 mins read

This KB illustrates that how to hide the check boxes and context menu in Field List.

Solution

In-general, PivotSchemaDesigner has many UI options to add/remove/move fields in desired field area. The options are,

  1. Drag and drop from Field List to field area   
  2. Check boxes
  3. Context menu

Below screen-shot shows the check boxes and context menu in PivotSchemaDesigner.

C:\Users\RameshG\Desktop\1.png

 

You can hide the check boxes and context menu under Field List of PivotSchemaDesigner by using below steps.

To hide check boxes, we can utilize their class name “.schemaFieldList .e-chkbox-small” and apply the CSS style “display: none”, which hides the entire check boxes under Field List.

To hide context menu, the required code is written inside the “OnAfterServiceInvoke” event of PivotSchemaDesigner. Like check boxes, we can utilize the class name of the context menu to remove it using jQuery. The code is like $(".pivotTreeContext").remove() under the function “hideContextMenu()” as mentioned in the below code sample.

NOTE: The class “.pivotTreeContext” of the context menu will be generated only after PivotGrid control is rendered. Calling the function “hideContextMenu()” before that could not be effective. So we have to set delay, in-order to activate the function “hideContextMenu()” using “setTimeout” function.

 

The code sample below illustrates on how to hide the check boxes in Field List.

CSS

<style>
    .schemaFieldList .e-chkbox-small {                     
        display: none;    }
</style>

 

 

The code sample below illustrates on how to hide the context menu in Field List.

Script

 
@Html.EJ().Pivot().PivotGrid("PivotGrid1").Url(Url.Content("~/wcf/RelationalService.svc")).ClientSideEvents(events => events.AfterServiceInvoke("OnAfterServiceInvoke"))
 
@Html.EJ().Pivot().PivotSchemaDesigner("PivotSchemaDesigner")
 
 
<script type="text/javascript">
    OnAfterServiceInvoke = function (evt) {
        if (evt.action == "initialize") {
            var PivotSchemaDesigner = $("#PivotSchemaDesigner").data('ejPivotSchemaDesigner');
            if (PivotSchemaDesigner.model.pivotControl == null) {
                PivotSchemaDesigner.model.enableWrapper = true;
                PivotSchemaDesigner.model.pivotControl = this;
                PivotSchemaDesigner.model.layout = "excel";
                PivotSchemaDesigner._load();
                setTimeout(hideContextMenu, 500);
            }
        }
    }
    function hideContextMenu() {
        $(".pivotTreeContext").remove();
    }</script>
 

 

Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment