Monday 15 August 2011

javascript - ExtJS - Remote filtering causes problems -


a) To help show this is a JS Bella: b) To repeat this problem, first drop down And select the notice how the full name appears, then expand the second drop down and note how the first drop down performance is over.

My impression is that this happens because both combobox uses the same store, when a filter applies to the store, it applies to everything, and thus when This record no longer exists, even then it loses back to the default value.

It does not happen, albeit there is data stored in the combo box even after any filter on a shop. I can not find any details on such a dualing combo box. Here is the listener who needs to be on the extension because I need the ability to filter each combobox differently:

  Audience: {extension: {fn : Function () {names.clearFilter (true); Names.filter ('id', 1); In fact, you do not want to share the stores between components. It can be counter-intuitive, but the store does not represent the entire data, but only  the component is currently working . The interface is the proxy for the entire data.  
  element   

So if you want to share the data, then you need to share what is proxy, do not store it.

Here, for example, Bella:

  var proxy = Ext.create ('Ext.data.proxy.memory', {reader: 'json', data {'Id': 0, "FirstName": "e-mail", "Lastime": "Alcatraz"}, {'id': 2, "First name": "fram", "last name": " Bastiate "}, {'id': 1," first name "": "intoxication", "last name": "cartoga"}} ... ...)}; var store1 = Ext.create ('Ext.data Proxy: field: ['id', 'FirstName', 'LastName'], Remote Filter: True, Remote Sort: Truth, Filter: [[property: 'ID', Value: 1}]} ); Var store2 = Ext.create ('Ext.data.Store', {Proxy: Proxy, Field: ['id', 'First Name ',' LastName '], Remote Filter: True, Remote Sort: Truth, Filter: [[property:' id ', value: 2}]}) // Create combo box, Extend state data store. 'form ':' local ' Ext. Templatespot ',' & lt; for tpl = ''. '& Gt;', '& lt; tpl if = "Firstname" & gt; ',' {FirstName} ',' & lt; / Tpl & gt; ',' ',' & Lt; Tpl if = "LastName" & gt; ',' {LastName} ',' & lt; / Tpl & gt; ',' & Lt; / Tpl & gt; '), Render: Ext.getBody ()}); // Create a combo box connected to the state data store. ('Ext.form.ComboBox', {fieldLabel: 'Choose Name', ID: 'nameCombo2', QueryMode: 'Local', Displayfield: 'Firstname', 'First Name', Store: Store2, DisplayPlus: Ext Create ('Ext. Tempplate', 'for =' '.' & Gt; ',' & lt; tpl if = "first name" & gt; ',' {FirstName} ',' & lt; / Tpl>, '', ',' & lt; / tpl & gt; ; '), Render: Ext.getBody ()};   

Now, your next question may be to obtain your safe-side data in that client-side memory proxy. Unfortunately, the Framework does not offer any solution box.

The easiest way is to load your data with a regular AJAX request once, in a memory proxy By entering this pass, pass this proxy to all of your stores.

Or you can be creative and try to implement your own proxy which is loading and caching over the client on the server A It mixes. It is very easy to override the memory proxy, but soon you will run into a bunch of difficult questions ... How to handle caching for operations with different complexes? How to manage request parameters at all? What about the other CRUED operations? e.t.c. If you want to try it in any way, you can look for inspiration (it has been written for the touch, so you can not use it directly, but principles are similar to ExtJS).

No comments:

Post a Comment