Results 1 to 3 of 3

Thread: How to use 1 http request with multiple combobox

  1. #1
    Sencha User
    Join Date
    Sep 2008
    Location
    Paris, France
    Posts
    18

    Default How to use 1 http request with multiple combobox

    Hello,

    First sorry for my bad english (I'm french ).

    I replace ExtJs 2 in my app by ExtJs3 and try some optimisation.
    I have a form with 8 combobox.
    Each combobox have his own store and when I refresh my form I obtain 8 http request.

    Because I use mode: 'local' in comboBox definition I would like reduce 8 http request to only 1.

    My responses was:
    Code:
    { statutimports: [
        {id:'1', name:'Cr', css:'1'},
        {id:'2', name:'Public', css:'1'}
    ]}
    Code:
    { level: [
        {id:'1', name:'Cannister', css:'1'},
        {id:'2', name:'ECE/Japan', css:'2'}
    ]}
    .......

    I think I could merge all response in one:
    Code:
    { 
       statutimports: [
              {id:'1', name:'Cr', css:'1'},
              {id:'2', name:'Public', css:'1'}
    ] ,
       level: [
              {id:'1', name:'Cannister', css:'1'},
              {id:'2', name:'ECE/Japan', css:'2'}
    
    ]}
    I defined 1 store per comboBox.
    Code:
    this.oJsonStore = new Ext.data.Store({
                    proxy: poProxy,
                    reader: new Ext.data.JsonReader({
                        root: psRoot 
                        },[id, name, css])
                });
    poProxy is the same instance of Ext.data.HttpProxy for all store.
    psRoot is a proper root associate to comboBox statutimports & level in my exemple.

    Unfortunatly each store submit a http request.

    I suppose I need to create a record who contains all my data and a reader for each combobox. But I didn't find how to do this. If someone could help me or say me where I can find example of code.

    Thanks

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    No, you only need to load the second store with the data from the first store, e.g.
    Code:
    store1.on('load', function(){
      store2.loadData(store1.reader.jsonData);
    });

  3. #3
    Sencha User
    Join Date
    Sep 2008
    Location
    Paris, France
    Posts
    18

    Default

    Thanks to your help., it's working perfect.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •