ComboBox Local Mode Filter Issue(Urgent)

  1. #1

    ComboBox Local Mode Filter Issue(Urgent)

    I have two combobox column in GridPanel (Country and State). I have filtered state client side only in beforeedit of gridpanel.

    Now when I type something (e.g abcd which is not in state) in state Combo and then clear the typed character without going out to edit mode of state combo, then it gives me all list of state even I filtered state in beforeedit listener of particular country.

    Screen also attached.

    I want filtered record only which is done in beforeedit even when I clears selection in state combo.

    Following is runnable simple sample.

    <%@ Page Language="C#" %>

    <%@ Import Namespace="System.Collections.Generic" %>

    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!X.IsAjaxRequest)
    {
    List<object> data = new List<object>
    {
    new {Country = "C1", State = "C1_S1"},
    new {Country = "C2", State = "C2_S1"},
    new {Country = "C3", State = "C3_S1"},
    };
    Store1.DataSource = data;
    Store1.DataBind();

    List<object> countries = new List<object>
    {
    new {Country = "C1"},
    new {Country = "C2"},
    new {Country = "C3"},
    };
    CountryStore.DataSource = countries;
    CountryStore.DataBind();

    List<object> states = new List<object>
    {
    new {Country = "C1", State="C1_S1"},
    new {Country = "C1", State="C1_S2"},
    new {Country = "C1", State="C1_S3"},
    new {Country = "C1", State="C1_S4"},
    new {Country = "C1", State="C1_S5"},
    new {Country = "C2", State="C2_S1"},
    new {Country = "C2", State="C2_S2"},
    new {Country = "C2", State="C2_S3"},
    new {Country = "C2", State="C2_S4"},
    new {Country = "C2", State="C2_S5"},
    new {Country = "C3", State="C3_S1"},
    new {Country = "C3", State="C3_S2"},
    new {Country = "C3", State="C3_S3"},
    new {Country = "C3", State="C3_S4"},
    new {Country = "C3", State="C3_S5"},
    };
    StateStore.DataSource = states;
    StateStore.DataBind();

    }
    }

    </script>

    <!DOCTYPE html>

    <html>
    <head id="Head1" runat="server">
    <title>Ext.NET Examples</title>
    <link href="/resources/css/examples.css" rel="stylesheet" />

    <script>
    var beforedit = function (editor, e) {
    if (e.field == 'state') {

    App.StateStore.clearFilter();
    App.StateStore.filter('Country', App.Store1.data.items[e.rowIdx].data.country);

    }
    };
    </script>
    </head>
    <body>
    <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />

    <ext:Store ID="CountryStore" runat="server" IDMode="Static">
    <Model>
    <ext:Model ID="Model1" runat="server" IDProperty="Country">
    <Fields>
    <ext:ModelField Name="Country" Type="String" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>

    <ext:Store ID="StateStore" runat="server" IDMode="Static" >
    <Model>
    <ext:Model ID="Model2" runat="server" IDProperty="State">
    <Fields>
    <ext:ModelField Name="Country" Type="String" />
    <ext:ModelField Name="State" Type="String" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>


    <ext:GridPanel
    ID="GridPanel1"
    runat="server"
    Height="300"
    Width="600"
    Title="Grid"
    ForceFit="true"
    IDMode="Static">
    <Store>
    <ext:Store ID="Store1" runat="server" >
    <Model>
    <ext:Model ID="Model5" runat="server">
    <Fields>
    <ext:ModelField Name="country" Type="String" Mapping="Country" />
    <ext:ModelField Name="state" Type="String" Mapping="State" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>
    </Store>
    <ColumnModel>
    <Columns>
    <ext:Column ID="Column1" runat="server" DataIndex="country" Text="Country">
    <Editor>
    <ext:ComboBox
    ID="CountryCombo"
    runat="server"
    QueryMode="Local"
    TriggerAction="All"
    StoreID="CountryStore"
    ValueField="Country"
    DisplayField="Country">
    </ext:ComboBox>
    </Editor>
    </ext:Column>

    <ext:Column ID="Column2" runat="server" DataIndex="state" Text="State">
    <Editor>
    <ext:ComboBox
    ID="StateCombo"
    runat="server"
    QueryMode="Local"
    StoreID="StateStore"
    ValueField="State"
    DisplayField="State">
    </ext:ComboBox>
    </Editor>
    </ext:Column>
    </Columns>
    </ColumnModel>

    <Plugins>
    <ext:CellEditing>
    <Listeners>
    <BeforeEdit Fn="beforedit"></BeforeEdit>
    </Listeners>
    </ext:CellEditing>
    </Plugins>
    </ext:GridPanel>

    </form>
    </body>
    </html>
    Attached Thumbnails Click image for larger version. 

Name:	LinkedCombo.png 
Views:	86 
Size:	55.7 KB 
ID:	5522  
  2. #2
    Anybody has solution?
  3. #3
    Hi,

    Here I am submitting the issue again.

    I have two combobox column in GridPanel (Country and State). I have filtered state client side only in beforeedit of gridpanel.

    Now when I type something (e.g abcd which is not in state) in state Combo and then clear the typed character without going out to edit mode of state combo, then it gives me all list of state even I filtered state in beforeedit listener of particular country.

    Screen also attached.

    I want filtered record only which is done in beforeedit even when I clears selection in state combo.

    Following is runnable simple sample.

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!X.IsAjaxRequest)
    {
    List<object> data = new List<object>
    {
    new {Country = "C1", State = "C1_S1"},
    new {Country = "C2", State = "C2_S1"},
    new {Country = "C3", State = "C3_S1"},
    };
    Store1.DataSource = data;
    Store1.DataBind();
    
    List<object> countries = new List<object>
    {
    new {Country = "C1"},
    new {Country = "C2"},
    new {Country = "C3"},
    };
    CountryStore.DataSource = countries;
    CountryStore.DataBind();
    
    List<object> states = new List<object>
    {
    new {Country = "C1", State="C1_S1"},
    new {Country = "C1", State="C1_S2"},
    new {Country = "C1", State="C1_S3"},
    new {Country = "C1", State="C1_S4"},
    new {Country = "C1", State="C1_S5"},
    new {Country = "C2", State="C2_S1"},
    new {Country = "C2", State="C2_S2"},
    new {Country = "C2", State="C2_S3"},
    new {Country = "C2", State="C2_S4"},
    new {Country = "C2", State="C2_S5"},
    new {Country = "C3", State="C3_S1"},
    new {Country = "C3", State="C3_S2"},
    new {Country = "C3", State="C3_S3"},
    new {Country = "C3", State="C3_S4"},
    new {Country = "C3", State="C3_S5"},
    };
    StateStore.DataSource = states;
    StateStore.DataBind();
    
    }
    }
    
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
    <title>Ext.NET Examples</title>
    <link href="/resources/css/examples.css" rel="stylesheet" />
    
    <script>
    var beforedit = function (editor, e) {
    if (e.field == 'state') {
    
    App.StateStore.clearFilter();
    App.StateStore.filter('Country', App.Store1.data.items[e.rowIdx].data.country);
    
    }
    };
    </script>
    </head>
    <body>
    <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
    <ext:Store ID="CountryStore" runat="server" IDMode="Static">
    <Model>
    <ext:Model ID="Model1" runat="server" IDProperty="Country">
    <Fields>
    <ext:ModelField Name="Country" Type="String" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>
    
    <ext:Store ID="StateStore" runat="server" IDMode="Static" >
    <Model>
    <ext:Model ID="Model2" runat="server" IDProperty="State">
    <Fields>
    <ext:ModelField Name="Country" Type="String" />
    <ext:ModelField Name="State" Type="String" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>
    
    
    <ext:GridPanel 
    ID="GridPanel1"
    runat="server" 
    Height="300" 
    Width="600"
    Title="Grid"
    ForceFit="true"
    IDMode="Static">
    <Store>
    <ext:Store ID="Store1" runat="server" >
    <Model>
    <ext:Model ID="Model5" runat="server">
    <Fields>
    <ext:ModelField Name="country" Type="String" Mapping="Country" />
    <ext:ModelField Name="state" Type="String" Mapping="State" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>
    </Store>
    <ColumnModel>
    <Columns>
    <ext:Column ID="Column1" runat="server" DataIndex="country" Text="Country">
    <Editor>
    <ext:ComboBox 
    ID="CountryCombo" 
    runat="server" 
    QueryMode="Local" 
    TriggerAction="All" 
    StoreID="CountryStore" 
    ValueField="Country"
    DisplayField="Country"> 
    </ext:ComboBox>
    </Editor>
    </ext:Column>
    
    <ext:Column ID="Column2" runat="server" DataIndex="state" Text="State">
    <Editor>
    <ext:ComboBox 
    ID="StateCombo" 
    runat="server" 
    QueryMode="Local"
    StoreID="StateStore" 
    ValueField="State"
    DisplayField="State">
    </ext:ComboBox>
    </Editor>
    </ext:Column>
    </Columns>
    </ColumnModel>
    
    <Plugins>
    <ext:CellEditing>
    <Listeners>
    <BeforeEdit Fn="beforedit"></BeforeEdit>
    </Listeners>
    </ext:CellEditing>
    </Plugins>
    </ext:GridPanel>
    
    </form>
    </body>
    </html>

Similar Threads

  1. Memory Leak with Grid Local Filter
    By reverseblade in forum 1.x Help
    Replies: 1
    Last Post: Apr 27, 2011, 10:00 AM
  2. [CLOSED] GridPanel local filter
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 15, 2011, 11:44 AM
  3. [CLOSED] GridPanel with Local Filter in HeaderRow instead of Plugins
    By mgowder in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 13, 2011, 3:52 PM
  4. [CLOSED] GridPanel local filter selectAll
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 23, 2011, 6:51 PM
  5. Replies: 4
    Last Post: Nov 11, 2010, 11:46 AM

Posting Permissions