ExtJS Combo loading remotely not working

This is my first bash using extJS and after a few hours of fighting some things work fine except that I have combo lists which I cannot filter down to less than 2000 items in extreme cases so I am trying to make lists of lists remotely but I must be doing something wrong.

My datastore and combo looks like this:

var remoteStore = new Ext.data.JsonStore({
        //autoLoad    : true,
        url         : 'addition-lists.aspx',
        fields      : [{name: 'extension_id'}, {name: 'extension'}],
        root        : 'extensionList',
        id          : 'remoteStore'               
    });
.
.
                        xtype         : 'combo',
                        fieldLabel    : 'Remote',
                        name          : 'remote',
                        displayField  : 'extension',
                        valueField    : 'extension_id',
                        mode          : 'remote', 
                        //pageSize      : 20,
                        triggerAction : 'query',  
                        typeAhead     : true,                    
                        store         : remoteStore,
                        anchor        : '95%'

      

The combo load is done locally, but as soon as I switch to the remote it remains blank.

My ASP.NET page returning JSON looks like this:

protected void Page_Load(object sender, EventArgs e)
{
    Response.Clear();
    Response.Write(GetRemote());
}

      

0


a source to share


5 answers


On remote storages, the combo sets the property minChars

to 4 by default , so the request is only sent after 4 characters are entered. Installation minChars

almost gives the desired behavior.



I say almost because even if the item requested by autocomplete is on the current page, a new request is still sent to the server, by default selecting the first item on a new page.

+2


a source


As you set up your store above, the output of your ASP script should read something like this:

{"extensionList": [
  {"extension_id": 1, "extension": "js"},
  {"extension_id": 2, "extension": "aspx"}
]}

      



If it doesn't, your remote store won't find anything.

+1


a source


You can refer to this question ExtJS List Issue in IE

0


a source


A few things. First, with this:

remoteStore.loadData (<% = GetRemote ()%>);

you are not actually making a remote call from your javascript. You are echoing the result of calling the server function GetRemote directly on the page at render time. Probably not what you intend? If GetRemote is recording your combo data (and working correctly), you should be able to use the combo setting for local data. If the intent is to make a remote call, you need to remove the server tag and load the data through the proxy url, as shown in several examples that come with Ext.

Another thing is that your Page_Load code doesn't actually show anything about how you load, format, or return your data. I would suggest looking at the source and checking that your tag is actually being replaced with the data you expect. If / when you switch it to a real remote call to load data, you can use Firebug to inspect your XHR calls and validate the data coming in that way.

0


a source


You must set up a proxy, i.e. install

proxy: new ScriptTagProxy

to download the "store" remotely. See examples for exact syntax.

EDIT: Please ignore my previous post as you are using a JsonStore shortcut.

Try applying all of these properties to your combo:

   typeAhead: true,
   typeAheadDelay: 500,
   triggerAction: 'all',
   selectOnFocus:true,

      

And please don't prefetch server side (using loadData). This is very detrimental to the internal filter, so you stick to filtered entries from different presets. On the other hand, if you are prefetching all records on the server side, why would you need remote access for your combo ?!

-1


a source







All Articles