Declined
Last Updated: 08 Feb 2021 17:03 by ADMIN
ADMIN
Peter
Created on: 12 Sep 2013 10:09
Category: PivotGrid
Type: Bug Report
4
FIX. RadPivotFieldList - does not display CustomName if field is removed and added again.

		
3 comments
ADMIN
Dimitar
Posted on: 08 Feb 2021 17:02

Hello,

It is possible to define a group description with CustomName like this:

this.provider.RowGroupDescriptions.Add(new PropertyGroupDescription()
{
    PropertyName = "Product",
    CustomName = "CustomProduct"
});

If you remove that description and add it again from the pivot field list its custom name will be lost. This, however, is not an issue because RadPivotFieldList does not work with custom names. Dragging and dropping a field from the field list generates a new group description and you have to set its CustomName again.

A possible solution is to access the generated group description in the PrepareDescriptionForField event of the provider and set its custom name. The custom name will be displayed both in RadPivotGrid and the field list.

private void Provider_PrepareDescriptionForField(object sender, PrepareDescriptionForFieldEventArgs e)
{
    if (e.Description.DisplayName == "Product" && e.Description is PropertyGroupDescription customDescription)
    {
        customDescription.CustomName = "CustomProduct";
    }
}

The text of the nodes building the tree with the fields can be easily customized in the RadPivotFieldList.FieldListControl.NodeFormatting event:

private void FieldsControl_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
{
    if (e.Node.Text == "Product")
    {
        e.NodeElement.ContentElement.Text = "CustomProduct";
    }
}

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 19 Jan 2021 11:50

Hello, Michael,

Please have in mind that RadPivotFieldList refreshes the nodes regularly according to the fields of the applied DataSource collection. That is why dynamic changing of the node's Text will be overridden with the next reloading of the tree view. Usually, you can use the NodeFormatting event to force specific text to be visually available in the node. However, this wouldn't be a stable solution.

Make sure that you cast your vote for the item in order to increase its priority. The more votes an item gathers, the higher its priority becomes.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Michael
Posted on: 19 Jan 2021 11:23
I don't know what it has to do with removing-and-adding.  The problem is that assigning to Node.Text doesn't work.