1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    11
    Vote Rating
    0
    ImperioG is on a distinguished road

      0  

    Question Combobox loaded remotely and scriptTagProxy question..

    Combobox loaded remotely and scriptTagProxy question..


    Hi! (sorry for my english..)

    I'm trying to populate this combobox remotely but i can't figure out what is wrong with the code.. it works fine when i configure it to work locally but when i link the store to the remote url it doesn't load anything.. the code is very simple where is the error?? .. firebug doesn't show me any error .. therefore .. if i well intended the autoLoad property should fire the load action on the store as soon as possible right? Why it doesn't works in this example (i had to implement an afterender event to load the store..)?

    live example

    the code:
    Code:
    Ext.onReady(function() {
    new Ext.Window({
    x:0,
    y:0,
    width:300,
    height:450,
    items:[
        {xtype:'form',
         title:'Form',
         id:'testForm',
         width:'100%',
         layout:'form',
         items:[
         {
              fieldLabel : 'Mezzo',
              name : 'mz',
              xtype : 'combo',
              displayField : 'descrizione',
              autoLoad:true,
              //mode : 'local',
              mode : 'remote',
              emptyText : 'seleziona un mezzo...',
              store : new Ext.data.XmlStore({
              record:'mezzo',
              //url:'data/mezzi.xml'
              url:'leggimezzi.php',
              fields:['descrizione']
              }),
              listeners:
              {
                  afterrender:function(){this.store.load();}
              }
         }
         ]
        }
       ]
    }).show();
    });
    about the scripttagproxy question.. i read several examples (like this) implementing the scripttagproxy but they didn't use the callback parameter at all.. can someone explain me better this concept? this parameter must point to a real implementation of this callback function?

    thanks very much for your help!!..

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. You probably want to configure your combobox with triggerAction:'all'.

    2. Do not use width:'100%'. Instead, make your window layout:'fit'.

    3. You know you can't use a ScriptTagProxy with XML?

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    But with that being a relative URL, there's no need to use ScriptTagProxy. It's random coding.

  4. #4
    Sencha User
    Join Date
    Mar 2010
    Posts
    11
    Vote Rating
    0
    ImperioG is on a distinguished road

      0  

    Question


    thanks for your answers they were useful..

    You probably want to configure your combobox with triggerAction:'all'
    Ok Condor, setting that property if i press the down arrow the combobox load the store but the autocomplete function still doesn't work in the remote version..
    why it work properly in the local version and not remotely?? what i'm missing??

    try the live example.. now it shows both the versions .. the behaviour is different and i don't know why..

    But with that being a relative URL, there's no need to use ScriptTagProxy. It's random coding.
    i setup an XmlStore on the fly is some other property needed to work remotely? some property to set in the form-panel configuration?
    about the STProxy i simple didn't understood well the callback property and how to use it.. sorry if i didn't explain myself right ..

    i report the code regarding the 2 comboboxes

    Code:
    Ext.onReady(function() {
    new Ext.Window({
    x:20,
    y:20,
    width:300,
    height:250,
    items:[
        {xtype:'form',
         title:'Form',
         id:'testForm',
         layout:'form',
         items:[
         {
              fieldLabel : 'Remote',
              name : 'mz_r',
              xtype : 'combo',
              triggerAction:'all',
              displayField : 'descrizione',
              autoLoad:true,
              mode : 'remote',
              emptyText : 'seleziona un mezzo...',
              store : new Ext.data.XmlStore({
              record:'mezzo',
              url:'leggimezzi.php',
              fields:['descrizione']
              }),
              listeners:
              {
                  afterrender:function(){this.store.load();}
              }
         },
         {
              fieldLabel : 'Local',
              name : 'mz_l',
              xtype : 'combo',
              displayField : 'descrizione',
              autoLoad:true,
              mode : 'local',
              emptyText : 'seleziona un mezzo...',
              store : new Ext.data.XmlStore({
              record:'mezzo',
              url:'data/mezzi.xml',
              fields:['descrizione']
              }),
              listeners:
              {
                  afterrender:function(){this.store.load();}
              }
         }
         ]
        }
       ]
    }).show();
    });
    thanks very much for your help..

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    In remote mode autoComplete starts working after typing minChars (defaults to 4).

  6. #6
    Sencha User
    Join Date
    Mar 2010
    Posts
    11
    Vote Rating
    0
    ImperioG is on a distinguished road

      0  

    Default


    thanks Condor i missed that property but it wasn't the cause of the problem. I read more carefully the documentation and i solved the question: the property 'mode' must be set to '_local_' even for the remote combobox!.. the autocomplete function didn't work because the remote mode force to load the entire store each time.. i hope this could be useful for other users!!
    Any suggest about the scriptTagProxy question?

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Yes. As I said, you don't need to use it!

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. mode:'remote' is especially useful when using triggerAction:'query'. For triggerAction:'all' I would indeed suggest to preload the store and use mode:'local'.

    2. Why are you interested in ScriptTagProxy? You don't have to make requests to a different domain and your are using XML. Both reasons why you don't need/can't use ScriptTagProxy.

Similar Threads

  1. Replies: 2
    Last Post: 25 Nov 2009, 6:30 AM
  2. Help loading combobox remotely...
    By Liminality in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 4 Jun 2009, 12:22 PM
  3. ComboBox load data from store remotely
    By Choleriker in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 29 Aug 2007, 2:38 AM
  4. Please Help: Not able to load data on Combobox remotely using JSONStore?
    By marimuthup in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 16 Jul 2007, 3:07 AM

Thread Participants: 2

Tags for this Thread