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

Datafilter and paging in unbound mode

7 Answers 149 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Parthiv
Top achievements
Rank 1
Parthiv asked on 13 Oct 2010, 07:24 AM

Hi,

I want to use both datafilter as well as paging in gridview and again columns for gridview are dynamic so i m creating dynamic source and assigning to radDataPager and at xaml or design side i had assigned raddatapager in source for my gridview so in such manner my page was working..

now i want to add radDatafilter to my grid as i already defined elemenname in radgridview i assiged rad data filter to raddatapager and again column or data column are not fixed so that should be dynamic so for that i had used ItemPropertyInfo.

now my problem is while i run my control it will display data and data in raddatafilter too but when i  put filter and click on match button than its not effecting anywhere so pls tell me wht i m suppose to do ???????????

Pls help me ASAP please ....................
below is my  code for xaml

     <grid:RadDataFilter Name="radDataFilter"    />     
    <grid:RadGridView x:Name="FormsGrid" Margin="25,0,10,0" CanUserFreezeColumns="False"  AutoGenerateColumns="False"    ScrollMode="RealTime" MinHeight="300"   BorderThickness="1,6,1,1" telerik:StyleManager.Theme="Office_Blue" ScrollViewer.HorizontalScrollBarVisibility="Visible"  ItemsSource="{Binding PagedSource, ElementName=radDataPager1}"  ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="FormsGrid_SelectionChanged" >

   </grid:RadGridView>
     <grid:RadDataPager x:Name="radDataPager1" telerik:StyleManager.Theme="Office_Blue"
           PageSize="10"
           Source="{Binding FilteredSource, ElementName=radDataFilter}"
           DisplayMode="All"         
           IsTotalItemCountFixed="True"
           Margin="25,0,10,0"/>


7 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 13 Oct 2010, 08:45 AM
Hello Parthiv,

And where is the data coming from? I can't see any data here.

Why don't you try the following. Create you data source the way you do it. Assign this data source to the grid:

IEnumerable data = <<some data coming from somewhere>>;
this.radGridView.ItemsSource = data;

Then link the pager like this:

this.radDataPager.Source = this.radGridView.Items;

Finally, link the data filter like this:

this.radDataFilter.Source = this.radGridView.Items;

Also, make sure that you turn off  the grid's built-in filtering (the little funnels in the column headers), because you cannot mix RadDataFilter and RadGridView's built-in filtering.

I hope this helps.

In case it does not, I would like to ask you to prepare an dummy runnable sample project, open a separate support ticket and attach it. We will examine it and see what are you doing.

Thanks in advance.

All the best,
Ross
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Parthiv
Top achievements
Rank 1
answered on 13 Oct 2010, 12:08 PM
Hi Ross,

Thanks for your quick response...
in my scenario we dont have fixed column so using below code i m creating column and adding to gridview dynamically and then i used to assign dictionary to RadDataPager .

 

 

for (int i = 0; i < columnCount; i++)

 

{

 

 

XElement element = myDoc.Element("NewDataSet").Element("Table").Elements().ElementAt(i);

 

dgtc =

 

new GridViewDataColumn();

 

dgtc.MinWidth = 100;

dgtc.IsReadOnly =

 

true;

 

dgtc.Width =

 

GridViewLength.SizeToHeader;

 

dgtc.Header = element.Name.ToString().Replace(

 

"_x0020_", " ").Replace("_x0028_", " (").Replace("_x0029_", ") ");

 

 

 

dgtc.DataMemberBinding = new Binding(element.Name.ToString().Replace("-", " "));

 

dgtc.DataMemberBinding.Source = element.Name;

 

 

indexingConverter convert = new indexingConverter();

 

 

 

Binding bind = new Binding { Converter = convert, ConverterParameter = element.Name };

 

dgtc.DataMemberBinding = bind;

 

FormsGrid.Columns.Add(dgtc);

}

and then i used to bind datasource  to Raddatapager.
radDataPager1.Source = datasource;
 
and yes for RadDataPager at the time of dynamic column i have created item propertyinfo and that is again
assign to RadDataFilter

 

 

 

List<ItemPropertyInfo> infos = new List<ItemPropertyInfo>();

 

this

 

 

.radDataFilter.ItemProperties = infos;


I hope you get my point wht i m doing and by doing above step i m able to fill combo inside RadDataFilter but the same is fired ,,,,

 


i m stuck up now ....

i tried your way but it show me key,value and compared data in RadDataFilter i want columname over der....

0
Rossen Hristov
Telerik team
answered on 13 Oct 2010, 12:28 PM
Hi Parthiv,

You have two options then.

You can use the DisplayAttribute.ShortName Data Annotation on the property of interest. If you specify this attribute RadDataFilter will show the friendly name instead of the true property name. You will link the three controls like I described in my previous post.

You can decide to use RadDataFilter in Unbound Mode like you are currently doing, i.e. using ItemPropertyInfo's means that RadDataFilter.Source should be null.

If you decide to go this way, you will need to listen for RadDataFilter.FilterDescriptors changes and perform the filtering by hand on the grid by adding these filters.

This example shows how to do this with a DomainDataSource, but it should be similar with a RadGridView. Make sure you check out the other examples of RadDataFilter and RadDataPager. I am sure they will shed a light on a lot of questions that you have.

What you have to do is transfer the FilterDescriptors that RadDataFilter produces to the RadGridView.FilterDescriptors property. Adding stuff to RadGridView.FilterDescriptors will in fact filter it.

Here is a blog post concerning RadGridView filtering.

The pager does not really matter here, but here is my tutorial concerning paging and all possible architectures.

You can check my other blog posts out as well. I am sure you can find interesting topics there.

I hope this helps.

All the best,
Ross
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Parthiv
Top achievements
Rank 1
answered on 13 Oct 2010, 12:56 PM
Hi Ross,

Thank you so much for your quick response.
now I am confused totally , i hav not decided to go in such manner only but yes my requirement is like dat if u can suggest any gud or better idea then i ll follow d same.

my requirement is

I dont have specific column and run time on basis of passed parameter i hav to define column and then on dat bassis i hav to bind
datasource .....

now with this dynamic GridView my client wants me to put paging and RadDatafilter also.......

so this is my requiremnt if u can suggest one final solution or best solution then it would be helpful to me.

Thanks once again
and waiting for your reply please .........
0
Rossen Hristov
Telerik team
answered on 13 Oct 2010, 02:54 PM
Hello Parthiv,

You haven't read a single link of the ones that I have provided, have you? Please, cover them first.

Personally, I would not use the filter in Unbound Mode. I would use the DisplayAttribute.ShortName property. Then I would bind all three controls in the following way:

this.radGridView.ItemsSource = <<your data here>>;
this.radDataFilter.Source = this.radGridView.Items;
this.radDataPager.Source = this.radGridView.Items;

Please, read all of the links and examples that I have posted very carefully. After you do this you will not be confused anymore and you will be able to ask more informed and specific questions. Covering the documentation of RadDataFilter and that of RadDataPager is also a good idea before you try to develop with them.

Thank you.

Greetings,
Ross
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Parthiv
Top achievements
Rank 1
answered on 14 Oct 2010, 06:36 AM
Hi Ross,

I read your each n every line and example and using your way i m not getting output
as u told that we are suppose to go for DisplayAttribute shortname then dear friend if i  dont know property and column then how can i use short name so i don't use shortname and the link which you gave me is just for declaration syntax so didn't getting  how i can use in my example and also don't know by following those three line do i need to assing and source or itemsource at xaml or design page ?
because by only following those three line in my datafilter i found "Comparer,Count,Key,Values" and if i ll use info property then i m getting my column name over der but when i click on match case button then result is not firing and rest is  working i mean dynmaically able to load all columns in datafilter also but when click on match case result is not filtered....

and yes i m fresher for this so i dont know much about it so please donot shout on me , yes i know i asked not worthy query but i hope u ll understand.. nyways.

thanks for your all those replies.
0
Veselin Vasilev
Telerik team
answered on 20 Oct 2010, 09:24 AM
Hi Parthiv,

Please accept our apologies if we sound rude. We did not mean to offend you.

In order to provide you with a solution - can you please send us a small working example which shows the way you implemented our controls and the exact problem you face.
We will try to provide the best solution for you.

In addition, we have introduced a new feature of RadDataFilter - ItemPropertyDefinitions where you can manually add fields in the combobox to filter against. Please check the online demo here.

Kind regards,
Veselin Vasilev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
DataFilter
Asked by
Parthiv
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Parthiv
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or