This is a migrated thread and some comments may be shown as answers.

Hiding and Sorting fields in the ConfigurationPanel

1 Answer 62 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 04 Aug 2014, 12:55 AM
Hi there.

How can I hide certain fields in the All Fields list in the ConfigurationPanel?

I can iterate through the pvtAD.Fields collection in the pvtAD_PreRender method and find the fields I want to hide but when I use pvtAD.Fields[i].IsHidden = true; it doesn't hide it. It still appears and also the update doesn't work when I apply any config changes.

And how can I do something like this?
pvtAD.Fields = pvtAD.Fields.OrderBy(x => x.Caption).ToList();

Many thanks,
Chris 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 07 Aug 2014, 08:04 AM
Hello Chris,

You can use the following approach to access the field elements:
<ClientSettings>
    <ClientEvents OnPivotGridCreated="pivotGridCreated" />
</ClientSettings>
JavaScript:
function pivotGridCreated(sender, args) {
    var panel = sender.get_configurationPanel().get_element();
    var container = $(panel).find("rpgAllFieldsContainer,.rpgFieldsContainer")[0];
    var fields = $(container).children();
 
    fields.each(function (i, el) {
        if (el.id.endsWith("_ShipName_Hidden") || el.id.endsWith("_ShipCountry_Hidden")) {
            el.style.display = "none";
        }
    });
}

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PivotGrid
Asked by
Chris
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or