The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

Bug in list filter with remote filter

  1. #1

    Bug in list filter with remote filter


    I'm strugled with a nasty bug.

    I have to paginate a grid withe a lot of data so, I put a remote filter in it but when I try to filter on a list, I got this message :

    Uncaught TypeError: Cannot read property 'items' of null
    at E.getOptionsFromStore (ext.axd?v=19950:19)
    at E.createListStore (ext.axd?v=19950:19)
    at E.bindMenuStore (ext.axd?v=19950:19)
    at E.onDataChanged (ext.axd?v=19950:19)
    at (ext.axd?v=19950:19)
    at E.doFireEvent (ext.axd?v=19950:19)
    at E.a.doFireEvent (ext.axd?v=19950:19)
    at E.fireEventArgs (ext.axd?v=19950:19)
    at E.fireEvent (ext.axd?v=19950:19)
    at E.loadRecords (ext.axd?v=19950:19)
    I get this example : and it apears it works, unles I remove the Oprion parameter ftom the ListFilter, then, it crashes.

    Here the example modified by me

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <script runat="server">
        protected void Store1_RefreshData(object sender, StoreReadDataEventArgs e)
            List<object> data = FiltersTestData.Data;
            string s = e.Parameters["filter"];
            //-- start filtering ------------------------------------------------------------
            if (!string.IsNullOrEmpty(s))
                FilterConditions fc = new FilterConditions(s);
                foreach (FilterCondition condition in fc.Conditions)
                    Comparison comparison = condition.Comparison;
                    string field = condition.Field;
                    FilterType type = condition.Type;
                    object value;
                    switch (condition.Type)
                        case FilterType.Boolean:
                            value = condition.Value<bool>();
                        case FilterType.Date:
                            value = condition.Value<DateTime>();
                        case FilterType.List:
                            value = condition.List;
                        case FilterType.Number:
                            if (data.Count > 0 && data[0].GetType().GetProperty(field).PropertyType == typeof(int))
                                value = condition.Value<int>();
                                value = condition.Value<double>();
                        case FilterType.String:
                            value = condition.Value<string>();
                            throw new ArgumentOutOfRangeException();
                        item =>
                            object oValue = item.GetType().GetProperty(field).GetValue(item, null);
                            IComparable cItem = oValue as IComparable;
                            switch (comparison)
                                case Comparison.Eq:
                                case Comparison.Like:
                                case Comparison.In:
                                    switch (type)
                                        case FilterType.List:
                                            return !(value as List<string>).Contains(oValue.ToString());
                                        case FilterType.String:
                                            return !oValue.ToString().StartsWith(value.ToString());
                                            return !cItem.Equals(value);
                                case Comparison.Gt:
                                    return cItem.CompareTo(value) < 1;
                                case Comparison.Lt:
                                    return cItem.CompareTo(value) > -1;
                                    throw new ArgumentOutOfRangeException();
            //-- end filtering ------------------------------------------------------------
            //-- start sorting ------------------------------------------------------------
            if (e.Sort.Length > 0)
                data.Sort(delegate(object x, object y)
                    object a;
                    object b;
                    int direction = e.Sort[0].Direction == Ext.Net.SortDirection.DESC ? -1 : 1;
                    a = x.GetType().GetProperty(e.Sort[0].Property).GetValue(x, null);
                    b = y.GetType().GetProperty(e.Sort[0].Property).GetValue(y, null);
                    return CaseInsensitiveComparer.Default.Compare(a, b) * direction;
            //-- end sorting ------------------------------------------------------------
            //-- start paging ------------------------------------------------------------
            int limit = e.Limit;
            if ((e.Start + e.Limit) > data.Count)
                limit = data.Count - e.Start;
            List<object> rangeData = (e.Start < 0 || limit < 0) ? data : data.GetRange(e.Start, limit);
            //-- end paging ------------------------------------------------------------
            //The Total can be set in RefreshData event as below
            //or (Store1.Proxy.Proxy as PageProxy).Total in anywhere
            //Please pay attention that the Total make a sence only during DirectEvent because
            //the Store with PageProxy get/refresh data using ajax request
            e.Total = data.Count;
            this.GridPanel1.GetStore().DataSource = rangeData;
    <!DOCTYPE html>
    <head runat="server">
        <title>GridPanel with Remote Filtering, Sorting and Paging - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <h1>GridPanel with Remote Filtering, Sorting and Paging</h1>
            <p>Please see column header menu for apllying filters</p>
                    <ext:GridPanel ID="GridPanel1" runat="server" Border="false">
                                    <ext:PageProxy />
                                    <ext:Model runat="server" IDProperty="Id">
                                            <ext:ModelField Name="Id" Type="Int" />
                                            <ext:ModelField Name="Company" Type="String" />
                                            <ext:ModelField Name="Price" Type="Float" />
                                            <ext:ModelField Name="Date" Type="Date" />
                                            <ext:ModelField Name="Size" Type="String" />
                                            <ext:ModelField Name="Visible" Type="Boolean" />
                                    <ext:DataSorter Property="Company" Direction="ASC" />
                        <ColumnModel runat="server">
                                <ext:Column runat="server" Text="ID" DataIndex="Id">
                                        <ext:NumberFilter />
                                <ext:Column ID="CompanyColumn" runat="server" Text="Company" DataIndex="Company">
                                        <ext:StringFilter />
                                <ext:Column runat="server" Text="Price" DataIndex="Price">
                                    <Renderer Format="UsMoney" />
                                        <ext:NumberFilter />
                                <ext:DateColumn runat="server" Text="Date" DataIndex="Date" Align="Center" Format="yyyy-MM-dd">
                                        <ext:DateFilter />
                                <ext:Column runat="server" Text="Size" DataIndex="Size">
                                        <ext:ListFilter />
                                <ext:Column runat="server" Text="Visible" DataIndex="Visible" Align="Center">
                                    <Renderer Handler="return (value) ? 'Yes':'No';" />
                                        <ext:BooleanFilter />
                            <ext:GridFilters runat="server" />
                            <ext:PagingToolbar runat="server" />
    I realy need help on this point.

  2. #2
    Problem is partially solved in 3.3.0. It doesn't crash anymore, meanwhile, filters are rebuild each time one is places, making list filter useles as only one can be selected, and if list filter are into other comumns than the one filtered, it is not possible to select it, the drop down filter menu appears but as soon as we move the cursor on it, it closes.

Similar Threads

  1. Replies: 8
    Last Post: Jun 05, 2016, 8:10 PM
  2. Replies: 9
    Last Post: Aug 11, 2015, 12:52 PM
  3. Replies: 1
    Last Post: Mar 20, 2013, 5:18 PM
  4. Remote filter for Header Filter
    By huzzy143 in forum 1.x Help
    Replies: 2
    Last Post: May 09, 2012, 4:43 PM
  5. Replies: 2
    Last Post: May 01, 2012, 5:57 PM

Posting Permissions