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

How do I filter?

2 Answers 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 05 Jun 2012, 02:55 PM
Hello,
I'm creating a dashboard for financial purpose... I've a main viewmodel that composed of

DateTime SelectionStart {get;set;}
DateTime SelectionEnd {get;set;}


I've also an item Indicator class

public Int ID {get;set}
public string Description {get;set;}
[...]
public IEnumerable<SNAPSHOT> Snapshots {get;set;}


SNAPSHOT in the meanwhile has

public int ID {get;set;}
public double VALUE {get;set;}
public datetime DT_TS {get;set;}

I've a radtimebar (with a chart) and a radgridview

I should display in the gridview the data just for the timebar's selected range... how should I bind the gridview to the filtered data?

I know I should have a method or property

public object GetItem()
       {
           var items =SelectedDataItem.SNAPSHOT.Where(o1 => SelectionDateStart < o1.DT_TS && o1.DT_TS < SelectionDateEnd);
 
           return items;
       }

But if I put this method in the viewmodel I've to manually recreate the relations (I use EF to map data from DB).......any suggestion?
Thanks

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 05 Jun 2012, 03:02 PM
Hello,

You need to filter the grid programmatically as describecd in this article. Read the Custom Filtering section. 

You will add two FilterDescriptors (for start and end time) and update their Value's when the time-bar values change. The grid will do the rest.

In case you want to do everything in a view model, you can use the QueryableCollectionView class, add the two descriptors to it instead of the grid and then bind the grid to the QCV.

I hope this helps.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michele
Top achievements
Rank 2
answered on 05 Jun 2012, 03:50 PM
Hello,
I've clarified the needs with the customer.....since we got a radtimebar on the top he wants that at the selectionchanged only 3 columns of the radgridview below..... how can I do this with filter? Since the grid below shows min/max/average/last value it would really be cool if I can do so...

Thanks


Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Michele
Top achievements
Rank 2
Share this question
or