ListFilter_Remote with Mapping

  1. #1

    Is there an example of ListFilter using StoreID

    I read this tread:http://forums.ext.net/showthread.php...-with-mappings,and tried to using "StoreID" of ListFilter,but the filters menu is always "Loading ...".
    What's wrong with it? Or is there an example of ListFilter using StoreID? Thanks.
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store2.DataSource = this.Data2;
                this.Store2.DataBind();
            }
        }
    
        protected void Store_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            object[] data = Data;
    
            string rawFilter = e.Parameters["filter"];
            if (!string.IsNullOrEmpty(rawFilter))
            {
                //data filter
            }
    
            this.GridPanel1.GetStore().DataSource = data;
            this.GridPanel1.GetStore().DataBind();
        }
    
        private object[] Data
        {
            get
            {
                return new object[]
                {
                    new { company = "3m Co",type = "1"},
                    new { company = "Alcoa Inc", type = "2"},
                    new { company = "Altria Group Inc", type = "2"},
                    new { company = "American Express Company", type = "3"},
                    new { company = "American International Group, Inc.", type = "3"}
                };
            }
        }
    
        private object[] Data2
        {
            get
            {
                return new object[]
                {
                    new { value = "1", label = "a"},
                    new { value = "2", label = "b"},
                    new { value = "3", label = "c"},
                    new { value = "4", label = "d"},
                    new { value = "5", label = "e"}
                };
            }
        }
    </script>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Store ID="Store2" runat="server">
            <Model>
                <ext:Model ID="Model2" runat="server" IDProperty="value">
                    <Fields>
                        <ext:ModelField Name="value" />
                        <ext:ModelField Name="label" />
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
        <ext:GridPanel ID="GridPanel1" runat="server">
            <Store>
                <ext:Store ID="Store1" runat="server" OnReadData="Store_OnRefreshData">
                    <Model>
                        <ext:Model ID="Model1" runat="server">
                            <Fields>
                                <ext:ModelField Name="company" />
                                <ext:ModelField Name="type" />
                            </Fields>
                        </ext:Model>
                    </Model>
                    <Proxy>
                        <ext:PageProxy />
                    </Proxy>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                    <ext:Column ID="Column1" runat="server" Text="Company" DataIndex="company" />
                    <ext:Column ID="Column2" runat="server" Text="Type" DataIndex="type">
                        <Renderer Handler="function(v){return {1:'a',2:'b',3:'c','4':'d',5:'e'}[v];}" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
            </SelectionModel>
            <Features>
                <ext:GridFilters>
                    <Filters>
                        <ext:ListFilter DataIndex="type" LabelField="label" StoreID="Store2" />
                      <%--  <ext:ListFilter DataIndex="type" Options="a,b,c,d,e" />--%>
                    </Filters>
                </ext:GridFilters>
            </Features>
        </ext:GridPanel>
        </form>
    </body>
    </html>
    Last edited by howardyin; May 02, 2012 at 1:44 AM. Reason: nobody reply

Similar Threads

  1. Problem of Field Mapping
    By howardyin in forum 2.x Help
    Replies: 1
    Last Post: Jul 20, 2012, 2:46 AM
  2. Ex.net.json with nhibernate mapping.
    By endiss in forum 1.x Help
    Replies: 1
    Last Post: Mar 23, 2012, 2:05 PM
  3. [CLOSED] Bug in Store Mapping
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 30, 2011, 11:05 AM
  4. [CLOSED] getRecordsValues now uses Mapping instead of Name
    By wazige in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 07, 2011, 1:54 PM
  5. mapping more complex objects to a Store
    By principal_X in forum 1.x Help
    Replies: 2
    Last Post: Jan 26, 2009, 6:16 PM

Posting Permissions