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

Filters format

3 Answers 108 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
manuele
Top achievements
Rank 1
manuele asked on 18 Mar 2015, 10:05 AM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Mar 2015, 07:56 AM
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.

 
0
manuele
Top achievements
Rank 1
answered on 24 Mar 2015, 03:17 PM
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
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Mar 2015, 09:30 AM
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.

 
Tags
PivotGrid and PivotFieldList
Asked by
manuele
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
manuele
Top achievements
Rank 1
Share this question
or