Thursday, 15 May 2014

extjs4 - Set combobox value after loading json store -


I have a COMBOBOX which I'm loading with this controller (code snippet below)

 < Code> Ext.getCmp ("combovalue2") getStore () loadRawData (value 2) ..   

value2 is the object being derived from the object and it works successfully (I verify this onclick of kickboxes). Below is a code snippet of code box in my form panel

  {xtype: 'combo', id: "combovalue2", name: 'cpa', cls: 'extracombobox', force selection: is correct Query Module: 'Local', Field Label: 'Alliance', Displayfield: 'Label', Wellfield: 'numAe', Empty Text: 'Select Alliance', Store: New Ext.data.JsonStore ({fields: ["numAe   

This looks like my Jason

  "cpaList": [{"label": "a communication", "id" " "", "Numerator", "numf": 999, "numAe": 483, "pctFeeCalc": 0, "pctFeeBasisPoint": {}, "label": "AC Nielsen, Inc.", "ID": "MMV" , "Number": 999, "numAe": 876, "pctFeeCalc": 20, "pctFeeBasisPoint": {}, "label": "Acer Worldwide Inc.", "id": "CAA", "numoff": 999, "numAe": 619, "pctFeeCalc": 0, "pctFeeBasisPoint": {}, "label": "Advantech, Inc.", "id": "SLE", "numoff": 999, "numee" : 592, "pctFeeCalc": 0, "pctFeeBasisPoint": 0}, {"label": "epho limited", "id": "nan", "numoff": 999, "numAe": 95 9, "pctFeeCalc "," PctFeeBasisPoint ": 0}, {" L "ABL": "All System Go", "ID": "BCS", "Mailoff": 999, "NMAE": 944, "PTTeconomic": 25 , "Ptfefilesepoint": {}, {"label": "Elisa Annie Lock", "ID": "GRE", "Mailoff": 999, "NewEe": 36 9, "PTTeconomic  

Mapping: 'cpaList'}

But I have a hard time displaying the value that should be displayed when theombbox is provided. I want to set the value of the Combo box coming from JSSN (This means that the value is an array of 2 objects and the one I want to set is the string) and also I display the array of data in the combobox which I am loadRawData (value2) .

You should not have RawData to load, because of the appearance of your code, your store Must have changed or you have to use a portion of your JSON data.

Your root is 'cpaList' Shop does not know what to do with it If you want to keep your code in the way, do the following:

  Ext.getCmp ("Combustible 2"). GetStore () LoadData (value2.cpaList);   

Otherwise you will have to change your store to match your data. If you actually define this store instead and set your combo store in the defined store, instead of loading it automatically on the render, then you do not need to request a separate AJAX request and your The code now belongs to your store.

  var store = Ext.create ('Ext.data.Store', {autoLoad: true, proxy: {type: 'ajax', url: '/ varvarurlis', reader: {type : 'Jason', root: 'CPIST' // The root of your data that has an array of fields for store}}, field: ["numAe", "label"]});    

No comments:

Post a Comment