[CLOSED] [1.0] ComboBox and Store

  1. #1

    [CLOSED] [1.0] ComboBox and Store

    Hello,

    I'm having a complication with a bit of code that was working previously -- not sure exactly when it started to fail but perhaps one of you know?

    Was using the below ComboBox as a typeahead and even when I type in 5 characters it isn't making a call in the background according to FireBug:

                                    <ext:ComboBox runat="server"
                                        DisplayField="CompanyName"
                                        EmptyText="Search for Company ..."
                                        EnableKeyEvents="true"
                                        ForceSelection="true"
                                        LoadingText="Searching ..."
                                        MinChars="2"
                                        QueryDelay="1000"
                                        QueryParam="Keywords"
                                        TypeAhead="true"
                                        ValueField="Id"
                                        Width="255">
                                        <Store>
                                            <ext:Store ID="Store1" runat="server"
                                                AutoLoad="false">
                                                <BaseParams>
                                                    <ext:Parameter Name="limit" Value="5" Mode="Raw" />
                                                    <ext:Parameter Name="start" Value="0" Mode="Raw" />
                                                    <ext:Parameter Name="dir" Value="ASC" />
                                                    <ext:Parameter Name="sort" Value="CompanyName" />
                                                </BaseParams>
                                                <Proxy>
                                                    <ext:HttpProxy AutoDataBind="true" Method="GET" Url='<%# Url.Action("Search", "Vendor", new { Area = "Management" } ) %>' />
                                                </Proxy>
                                                <Reader>
                                                    <ext:JsonReader IDProperty="Id" Root="data">
                                                        <Fields>
                                                            <ext:RecordField Name="Id" />
                                                            <ext:RecordField Name="CompanyName" />
                                                        </Fields>
                                                    </ext:JsonReader>
                                                </Reader>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>
    Suggestions?

    Cheers,
    Timothy
    Last edited by Daniil; Mar 21, 2011 at 7:20 PM. Reason: [CLOSED]
  2. #2
    Hi,

    The configuration looks fine. I can't see anything wring.

    Are you able to reproduce the issue using the following sample? It works fine on my side.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.Linq" %>
     
    <script runat="server">
        private object[] MyData = 
            new object[] 
            {
                new object[] { "aa" },
                new object[] { "bb" },
                new object[] { "cc" },
                new object[] { "aa1" },
                new object[] { "bb1" },
                new object[] { "bb2" }
            };
     
        protected void Store_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            Store store = sender as Store;
            string filter = e.Parameters["query"];
            var filteredList = from x in MyData
                               where (x as object[])[0].ToString().StartsWith(filter)
                               select x;
            store.DataSource = filteredList;
            store.DataBind();
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:ComboBox
            runat="server"
            DisplayField="test"
            ValueField="test"
            TypeAhead="false"
            LoadingText="Searching..."
            MinChars="2"
            HideTrigger="true">
            <Store>
                <ext:Store
                    runat="server"
                    AutoLoad="false"
                    OnRefreshData="Store_Refresh">
                    <Proxy>
                        <ext:PageProxy />
                    </Proxy>
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
        </ext:ComboBox>
        </form>
    </body>
    </html>
  3. #3
    Works in ASP.NET Forms, but my problem is in MVC.

    Here is a simplified example of it not working (not making any call backs to the server when I type in "Timothy"):

    ExampleController.cs
        public class ExampleController : Controller
        {
    		public ActionResult Index()
    		{
    			return View();
    		}
    
    		public ActionResult Child()
    		{
    			var result = PartialExtView();
    
    			result.ContainerId = "Panel1";
    			result.RenderMode = Ext.Net.RenderMode.AddTo;
    			result.WrapByScriptTag = false;
    
    			return result;
    		}
        }
    Index.aspx:
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Example</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" IDMode="Explicit" ScriptMode="Debug" Theme="Gray" />
        <ext:Panel ID="Panel1" runat="server" Height="100">
            <Listeners>
                <AfterRender Handler="Ext.Ajax.request( {
                        disableCaching: true,
                        scripts: true,
                        success: function(response) {
                            eval(response.responseText)
                        },
                        url: '/Example/Child'
                    } );" />
            </Listeners>
        </ext:Panel>
    </body>
    </html>
    Child.ascx:
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <ext:ComboBox runat="server"
    	DisplayField="CompanyName"
    	EmptyText="Search ..."
    	EnableKeyEvents="true"
    	ForceSelection="true"
    	LoadingText="Searching ..."
    	MinChars="2"
    	QueryDelay="1000"
    	QueryParam="Keywords"
    	TypeAhead="true"
    	ValueField="Id"
    	Width="255">
    	<Store>
    		<ext:Store runat="server"
    			AutoLoad="false">
    			<BaseParams>
    				<ext:Parameter Name="limit" Value="5" Mode="Raw" />
    				<ext:Parameter Name="start" Value="0" Mode="Raw" />
    				<ext:Parameter Name="dir" Value="ASC" />
    				<ext:Parameter Name="sort" Value="CompanyName" />
    			</BaseParams>
    			<Proxy>
    				<ext:HttpProxy AutoDataBind="true" Method="POST" Url='<%# "/Blah/Blah" %>' />
    			</Proxy>
    			<Reader>
    				<ext:JsonReader IDProperty="Id" Root="data">
    					<Fields>
    						<ext:RecordField Name="Id" />
    						<ext:RecordField Name="CompanyName" />
    					</Fields>
    				</ext:JsonReader>
    			</Reader>
    		</ext:Store>
    	</Store>
    </ext:ComboBox>
    Suggestions? I see that the BaseScriptBuilders were updated perhaps this has something to do with it?

    Cheers,
    Timothy
  4. #4
    Hi,

    Can you check what url is rendered for proxy?
  5. #5
    Hello vladsch,

    I changed the line to the following:

    <ext:HttpProxy Method="POST" Url="/Blah/Blah" />
    Still same result -- no callback.

    Cheers,
    Timothy
  6. #6
    Hi,

    Fixed in SVN. Please update Ext.Net and retest
  7. #7
    Works, you're a genius vladsch!

    Cheers

Similar Threads

  1. Replies: 2
    Last Post: Sep 15, 2014, 2:58 PM
  2. [CLOSED] [2.0] ComboBox store
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 19, 2012, 12:15 AM
  3. [CLOSED] ComboBox / Store / DataSource : Store.DataSource is NULL
    By wagger in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 24, 2011, 10:09 AM
  4. [CLOSED] [1.0] ComboBox and Store
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 11, 2010, 6:14 AM
  5. [CLOSED] ComboBox with no store
    By Moreno in forum 1.x Help
    Replies: 2
    Last Post: Dec 23, 2008, 5:29 PM

Posting Permissions