Support for Autofilter using different DataSources

Jun 10, 2012 at 1:40 PM

Hi Bhushan Poojary,

First of all: thanks for sharing so good project with community. It's a very cool project.

Second, yesterday I included your control in one project in which I want to bind a Xml source to my extended datagrid. It works fine, but when I added the autofilter option with true value for one of the columns, when i tried it, it does not work.

I read a little your code and I see that you are restricting the datasource to DataView, for example in AutoFilterHelper.GetDistinctValues (itemSource as DataView). 

I tried to add support for my xml doing some fast changes:

 

                //check for XmlNodeList
                if (itemSource is System.Collections.ICollection)
                {
                    Console.WriteLine("yes");
                    System.Collections.ICollection nodeList = itemSource as System.Collections.ICollection;

                    try
                    {                        
                        foreach (XmlNode xn in nodeList.AsQueryable())
                        {
                            String value = xn.SelectSingleNode(columnName).InnerText;                            
                            if (ditictValues.Count(c => c.Name.Equals(value) && c.IsSelectAll != "(Select All)") == 0)
                            {
                                //value = AddEscapeSequece(value);
                                ditictValues.Add(new CheckedListItem { Name = value, IsChecked = false });
                            }
                        }
                        if (ditictValues.Count(c => c.IsChecked) == ditictValues.Count - 1)
                            ditictValues[0].IsChecked = true;
                        CurrentDistictValues = ditictValues;
                    }
                    catch (InvalidCastException ex)
                    {

                    }

 

 

The problem is that there are many other pieces of your code that doesn' have into account this (ie: when you check or uncheck the filters) and it continue failing, so I had2 options: rewrite all, or asking you for help, because you know this much better... You're the father :)

 

Thanks in advance.

 

-Juan.

Coordinator
Jun 10, 2012 at 1:46 PM
Edited Oct 14, 2012 at 6:53 PM

Hi Jaun

 

I am leaving on vacation will be back on 19th June . I will try to make filter functionality accept interfaces too . I know filter functionality needs look .

By 25 th you will get more good features and new filter functionality (I will try to make it generic but it might work slow with other collections classes).

http://www.interviewforit.firm.in/wpfcontrolkit/Wpfcontrolkit.application

Above link is beta version of my full version.

 

Coordinator
Jun 10, 2012 at 1:48 PM
Edited Oct 14, 2012 at 6:53 PM

Hi Jaun

 

If you better ideas to make ICollection filtering faster do let me know. I will push it in my code. I will be back on 19th June.

And let me know where I can improve the grid?

Jun 10, 2012 at 2:00 PM

Thanks a lot for your really fast answer. 

If you're now on holidays, enjoy that! We can continue talking about this later :)

I forgot telling you the way I bind my data to the datagrid. It's like the next:

/**  SOURCE: AuthoFilterPlacerControl.xaml.cs**/       

 public void setXmlSource(){
            String xmlPath = @"c:\extendedgrid\test\xml\cdcatalog.xml";
            String xml = File.ReadAllText(xmlPath);
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(xml);
            XmlDataProvider xmlProvider = new XmlDataProvider();
            xmlProvider.XPath = "/CATALOG/CD";
            xmlProvider.Document = doc;           
            this.grid.DataContext = xmlProvider;
        }

 public AutoFilterPlacerControl()
        {          
            //DataContext = this;
            InitializeComponent();
            this.setXmlSource();
        }

I hope news when you can,

Thanks again!

Coordinator
Jun 24, 2012 at 5:07 PM
Edited Oct 14, 2012 at 6:53 PM

Hi

 

I am back from vacation I will start working on new AutoFilter soon. Will revert when I am done. But will post complete solution in http://wpfextendeddatagrid.codeplex.com/ first.