radPivotFieldList FieldList Name

10 posts, 0 answers
  1. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 21 May 2015 Link to this post

    Hello Telerik,

    I linked a radPivotFieldList with a radPivotGrid. All of my radPivotFieldList's Controls used the CustomName expect the FieldList.

    Is there any way to use Custom Name instead of Property Name ? 

     

    I try this code too but it doesn't work
    radPivotFieldList1.FieldsControl.Nodes[0].RootNode.Text="my text0";

    Finally I try to remove a Node and adding another but it doesn't work because of the FielList is automaticaly updating after : 

                     Telerik.WinControls.UI.RadTreeNode test = new RadTreeNode(){Value =radPivotFieldList1.FieldsControl.Nodes[0].Value, Text="test" } ;

                   radPivotFieldList1.FieldsControl.Nodes.Remove(radPivotFieldList1.FieldsControl.Nodes[0]);
                   radPivotFieldList1.FieldsControl.Nodes.Add(test);

     

    Best regards

  2. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 22 May 2015 Link to this post

    Hi Tony,

    Thank you for contacting us. 

    We have already logged this issue in our Feedback Portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link -  FIX. RadPivotFieldList - does not display CustomName if field is removed and added again

    Currently I can suggest you to subscribe to the FieldsControl.NodeFormattingRowLabelsControl.VisualItemFormatting and ColumnLabelsControl.VisualItemFormatting events and change the displayed text. Here is the code snippet: 
    void ColumnLabelsControl_VisualItemFormatting(object sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args)
    {
        var data = args.VisualItem.Data.DataBoundItem as Telerik.WinControls.UI.PivotFieldList.IField;
        if (data != null && data.FieldInfo.Name == "OrderID")
        {
            ((RadItem)args.VisualItem.Children[0]).Text = "Order ID";
        }
    }
     
    void RowLabelsControl_VisualItemFormatting(object sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args)
    {
        var data = args.VisualItem.Data.DataBoundItem as Telerik.WinControls.UI.PivotFieldList.ILabel;
        if (data != null && data.FieldInfo.Name == "OrderID")
        {
            ((RadItem)args.VisualItem.Children[0]).Text = "Order ID";
        }
    }
     
    void  FieldsControl_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e)
    {
        if (e.Node.Text == "OrderID")
        {
            e.NodeElement.ContentElement.Text = "Order ID";
        }
    }

    In the attachment you can find a sample demo and video which demonstrates the approach. 

    I hope this will help. Do not hesitate to write back with further questions. 

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 22 May 2015 in reply to Ralitsa Link to this post

    Hi Ralitsa.

    Thanks for your answer.

    It well works, i hope it could be automatised soon.

     Best regards

  5. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 22 May 2015 in reply to Tony Link to this post

    Hi Ralitsa,

     I've got the same problem with the radpivotgrid Associated. can you tell me events to suscribe ?

    Best regards

  6. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 26 May 2015 Link to this post

    Hi Tony,

    Thank you for your reply. 

    You can subscribe to the DataProvider.PrepareDescriptionForField event and set the CustomName property. Here is the code snippet: 
    private void DataProvider_PrepareDescriptionForField(object sender, PrepareDescriptionForFieldEventArgs e)
    {
        if (e.Description.DisplayName == "ShipCity")
        {
            e.Description = new PropertyGroupDescription() { PropertyName = e.Description.DisplayName, GroupComparer = new GrandTotalComparer(), CustomName = "Ship City" };
        }
    }

    In the attachments you can find the modified project. 

    I hope this will help you. Let me know if you have any other questions.

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 26 May 2015 in reply to Ralitsa Link to this post

    Hi Ralitsa.

    Thanks for your answer.

    I attach on the GroupDescriptorElementCreating event and it works

    Best regards

  8. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 28 May 2015 Link to this post

    Hi Tony,

    I am glad to hear that everything works fine for you now. Do not hesitate to write back if you have additional questions.

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 10 Jun 2015 in reply to Ralitsa Link to this post

    Hi,

     I've got a new question. How do you change the stringformat of an aggregateDescriptor created by user ? In fact, when users use the radpivotfield to define an aggregate descriptor, I attach myself to the AggregateDescriptorElementCreating event. But i don't find how to access to the stringFormat.

    I hope someone got the solution.

     Best regards

     

     

     

  10. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 15 Jun 2015 Link to this post

    Hi Tony,

    Thank you for contacting us. 

    You can refer to the following code snippet demonstrating how to change StringFormat property of the AggregateDescriptor in the handler of the AggregateDescriptorElementCreating event:
    void radPivotGrid1_AggregateDescriptorElementCreating(object sender, Telerik.WinControls.UI.AggregateDescriptorElementCreatingEventArgs e)
    {
        PropertyAggregateDescription agg = (PropertyAggregateDescription)e.AggregateDescriptorElement.AggregateDescriptor;
        if (agg.PropertyName == "OrderID")
        {
            agg.StringFormat = "C2";
        }
    }

    I hope this will help. Do not hesitate to write back with further questions.

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  11. Tony
    Tony avatar
    10 posts
    Member since:
    Mar 2015

    Posted 16 Jun 2015 in reply to Ralitsa Link to this post

    Hi Ralitsa,

    Thanks for your answer, it's well works.

    Best regards

Back to Top
UI for WinForms is Visual Studio 2017 Ready