Filters format

4 posts, 1 answers
  1. manuele
    manuele avatar
    22 posts
    Member since:
    Oct 2010

    Posted 18 Mar 2015 Link to this post

    Hi,
    is it possible to order alphabetically the tree of values in filters?
    is it possible to show Excel look like filter for DateTime values?

    Thanks a lot

    Manuele
  2. Answer
    Dess
    Admin
    Dess avatar
    1601 posts

    Posted 23 Mar 2015 Link to this post

    Hello Manuele,

    Thank you for writing.

    In order to sort the items in the PivotReportFilterPopup and PivotGroupFilterPopup, it is appropriate to use its PopupOpened.Here is a sample code snippet regarding the PivotReportFilterPopup:
    private void Form1_Load(object sender, EventArgs e)
    {
        this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);
     
        this.radPivotGrid1.ShowFilterArea = true;
     
        this.radPivotGrid1.FilterDescriptorElementCreating +=
            radPivotGrid1_FilterDescriptorElementCreating;
     
        this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription()
        {
            PropertyName = "OrderDate",
            Step = DateTimeStep.Year, GroupComparer = new GroupNameComparer()
        });
        this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription()
        {
            PropertyName = "OrderDate",
            Step = DateTimeStep.Quarter, GroupComparer = new GroupNameComparer()
        });
        this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription()
        {
            PropertyName = "OrderDate",
            Step = DateTimeStep.Month, GroupComparer = new GroupNameComparer()
        });
     
        this.radPivotGrid1.ColumnGroupDescriptions.Add(new PropertyGroupDescription()
        {
            PropertyName = "EmployeeID",
            GroupComparer = new GrandTotalComparer()
        });
     
        this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription()
        {
            PropertyName = "Freight",
            AggregateFunction = AggregateFunctions.Sum
        });
        this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription()
        {
            PropertyName = "Freight",
            AggregateFunction = AggregateFunctions.Average
        });
     
        this.radPivotGrid1.FilterDescriptions.Add(new PropertyFilterDescription()
        {
            PropertyName = "ShipCountry",
            CustomName = "Country"
        });
     
        this.radPivotGrid1.DataSource = this.ordersBindingSource;
    }
     
    private void radPivotGrid1_FilterDescriptorElementCreating(object sender,
        FilterDescriptorElementCreatingEventArgs e)
    {
        e.FilterDescriptorElement.FilterPopup.PopupOpened += FilterPopup_PopupOpened;
    }
     
    bool customized = false;
     
    private void FilterPopup_PopupOpened(object sender, EventArgs args)
    {
        PivotReportFilterPopup popup = sender as PivotReportFilterPopup;
     
        if (!customized)
        {
            //move item
            RadItem itemToMove = popup.Items[1];
            popup.Items.Remove(itemToMove);
            popup.Items.Insert(popup.Items.Count - 1, itemToMove);
             
            //sort tree nodes
            popup.TreeItem.TreeElement.TreeView.SortOrder = System.Windows.Forms.SortOrder.Descending;
             
            customized = true;
        }
    }

    As to your second question, I am not completely sure that I understand your requirement. By default, when you add a PropertyFilterDescription to the FilterDescriptions for a DateTime property, it offers a dialog, which contains a list with distinct column values, from which the end user can chose. Please refer to the attached screenshot. Could you please give us some more details about the desired look that you are trying to achieve? Thank you in advance. 

    I am looking forward to your reply.
     
    Regards,
    Dess
    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. manuele
    manuele avatar
    22 posts
    Member since:
    Oct 2010

    Posted 24 Mar 2015 in reply to Dess Link to this post

    Thank you for the support.

    Excel filter for DateTime value show a TreeView grouped by Year and Month
    i would like to add a filter like the screenshot attached

    Thanks

    Regards

    Manuele
  5. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 27 Mar 2015 Link to this post

    Hello Manuele,

    Thank you for writing back.

    The RadTreeView in the PivotReportFilterPopup displays all distinct values. Hence, all dates will be shown as nodes.

    In order to change this default functionality, you can use the FilterDescriptorElementCreatingEventArgs.FilterDescriptorElement.FilterPopup.PopupOpened event and manipulate the Nodes collection for the PivotReportFilterPopup.TreeItem.TreeElement.TreeView. However, in this case you should manually perform the filtering when checking/unchecking nodes.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top