iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello,
I have a gridview (WPF desktop application) who's binding source is ObservableCollection of struct. I am trying to implement filtering on this gridview but it does not filter after applying a filter.
Thank you for the snippet code.
I made a test project based on the snippet code. I was able to get the data displayed in UXGridView; sorting the data, but somehow unable to apply the filter. First thing that I suspect was the use of struct instead of class. Unfortunately this is not proven.
I enclosed the view (UXPage1.xaml file) and the view model (UXPage1ViewModel.cs file) of my sample to be evaluated. Please let me know your feedback if there is anything that I miss in the sample.
I will have the sample forwarded to UXGridView development team to be investigated further. Should I heard any news from the team regarding this, I will update this thread.
Edited on September 19, 2012 4:57 AM.Reason: Update solution.
I have a good news regarding the filtering problem on UXGridView.
...You typically use a collection that implements IPagedCollectionView as the data source. The IPagedCollectionView provides paging, sorting and filtering support to the underlying collection. You can bind the UXGridView to any IEnumerable collection; however, the UXGridView will behave as if the data is all on a single page. To provide paging, sorting and filtering functionality for an IEnumerable collection, you can wrap the collection in a PagedCollectionView instance...
Source: How-to: Implement Client-side Sorting, Filtering and Paging using UXGridView
Solution: wrap the collection in a PagedCollectionView instance. Please modify the ViewModel by adding the following line.
private PagedCollectionView _pagedCollectionView; public PagedCollectionView PagedCollectionView { get; set; }
Wrap the collection in a PagedCollectionView instance.
public void LoadData() { this.GridDatafin = new ObservableCollection<MyData>() { new MyData { keyword = "keyword0", sources = "sources0" }, ... new MyData { keyword = "keyword8", sources = "sources8" }, new MyData { keyword = "keyword9", sources = "sources9" } }; this.PagedCollectionView = new PagedCollectionView(this.GridDatafin); }
I enclosed the modified of my sample project for reference.
The filter feature in UXGridView can be implemented both client and server data operation. When you set the QueryOperation to Client, UXGridView will process the data filtering operation in the client against the given data source.
When QueryOperation is set to Server, UXGridView will not attempt to perform the data operation on the given data source. Instead it will store and distribute the query information to the one of QueryDescriptor property (in this case is the QueryDescriptor.FilterDescriptors property). When the collection changes, the QueryChanged event of the FilterDescriptor will be raised.
The live sample version of server side filtering is available in here and the client side filtering is available in here.
I’m willing to advise you further but in order to do so I would need you to elaborate on your specific scenario and possibly give me a step-by-step guide and a running simple sample that I can use to observe the reported problem.
Here is the observeable collection
ObservableCollection<MyData> GridDatafin = new ObservableCollection<MyData>();
Here is struct
public struct MyData { private string m_keyword; private string m_sources; public string keyword { get { return this.m_keyword; } set { this.m_keyword = value; } } public string sources { get { return this.m_sources; } set { this.m_sources = value; } } }
Here is XAML for gridview and custom filtering
<Intersoft:UXGridView Name="uXGridView1" SelectionUnit="Row" AutoGenerateColumns="False" CanUserFilterColumns="True" CanUserExport="True" VerticalAlignment="Stretch" Height="478"> <Intersoft:UXGridView.Columns> <Intersoft:UXGridViewTextColumn Header="Keyword" CanUserFilter="True" CanUserSort="True" Width="300" Binding="{Binding keyword}"> </Intersoft:UXGridViewTextColumn> <Intersoft:UXGridViewTextColumn Header="Sources" CanUserSort="True" CanUserFilter="True" Width="120" Binding="{Binding sources}" > <Intersoft:UXGridViewTextColumn.FilterItems> <Intersoft:UXDataFilterItem Content="Google"> <Intersoft:UXDataFilterItem.Filter> <Intersoft:CompositeFilterDescription LogicalOperator="And" > <Intersoft:FilterDescription PropertyName="sources" Operator="IsEqualTo" Value="Google"/> </Intersoft:CompositeFilterDescription> </Intersoft:UXDataFilterItem.Filter> </Intersoft:UXDataFilterItem> <Intersoft:UXDataFilterItem Content="Yahoo"> <Intersoft:UXDataFilterItem.Filter> <Intersoft:CompositeFilterDescription LogicalOperator="And" > <Intersoft:FilterDescription PropertyName="sources" Operator="IsEqualTo" Value="Yahoo"/> </Intersoft:CompositeFilterDescription> </Intersoft:UXDataFilterItem.Filter> </Intersoft:UXDataFilterItem> <Intersoft:UXDataFilterItem Content="Bing"> <Intersoft:UXDataFilterItem.Filter> <Intersoft:CompositeFilterDescription LogicalOperator="And" > <Intersoft:FilterDescription PropertyName="sources" Operator="IsEqualTo" Value="Bing"/> </Intersoft:CompositeFilterDescription> </Intersoft:UXDataFilterItem.Filter> </Intersoft:UXDataFilterItem> </Intersoft:UXGridViewTextColumn.FilterItems> </Intersoft:UXGridViewTextColumn> </Intersoft:UXGridView.Columns> </Intersoft:UXGridView>
Its itemsource property is set in source when it populates observable collection for the first time. This is thread progress changed event code which populates the observable collection.
ArrayList arrlst = (ArrayList)e.UserState; for (int m = 0; m < arrlst.Count; m++) { string[] rs = (String[])arrlst[m]; MyData dt = new MyData(); dt.keyword = rs[0]; dt.sources = rs[1]; GridDatafin.Add(dt); }
I have tested with both QueryOperation="Client" and QueryOperation="Server"
Now all the data gets populated perfectly. Its just the filter.
Let me know thanks
Many Thanks Yudi and Team,
This solved the filtering problem.
Glad to hear the good news.
Should you need further assistance or run into any problems regarding our controls, feel free to post it into the community site. We would be happy to assist you again.
I happened to see this post and I was quite attracted by this problem on the gridview filtering. Though to read this passage spend me much time, I think I gained a lot on the gridview component.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname