1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    blacksword888 is on a distinguished road

      0  

    Red face ComboBox whith datastore gives a blank page !

    ComboBox whith datastore gives a blank page !


    Hi,
    I'm trying to add a combobox to a formPanel , when i connect this combox with a datastore , it gives me a blank page , when i delete only its store property , i get my FormPanel displayed with other fields

    Thank you

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,590
    Vote Rating
    322
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    You'll need to post the code for your combobox and store. Please use code tags (# icon in the editor) and preview your post prior to submitting to make sure it is readable.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    blacksword888 is on a distinguished road

      0  

    Default


    This is the code that isn't working

    Code:
            var simple = new Ext.FormPanel({
                url:'save-form.php',
                id :'simple',
                autoScroll :'auto',
                frame:true,
                title: 'Ajouter Medecin',
                bodyStyle:'padding:5px 5px 0',
                width: 500,
                defaultType: 'textfield',
    
                items: [
                    {
                        fieldLabel: 'Nom',
                        id: 'nomMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },
                    {
                        fieldLabel: 'Prenom',
                        id :'prenomMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },{
                        fieldLabel: 'Secteur',
                        id: 'secteurMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },new Ext.form.ComboBox({
                store :SpecialiteDataStore,
                displayField:'nomSpecialite',         // we have two indexes, ID and Name
                typeAhead: true,
                mode: 'remote',
                triggerAction: 'all',
                selectOnFocus:true,
                fieldLabel: 'Nom',
                id :'put1',
                name : 'nomCab',
                anchor:'100%'
                }),
                    new Ext.form.RadioGroup({
                            fieldLabel: 'Potentiel',
                            vertical: false,
                            id:'potentielMedecin',
                            items: [
                                    {boxLabel: 'A', name: 'pot'+num, inputValue: 'a'},
                                    {boxLabel: 'B', name: 'pot'+num, inputValue: 'b'},
                                    {boxLabel: 'C', name: 'pot'+num, inputValue: 'c'}
                                    ]})
                ],
                buttons: [
                        {
                    text: 'Ajouter medecin ',
                    align :'left',
                    handler: createMedecin
                },{
                    text: 'Ajouter etablissement ',
                    align :'left',
                    handler: addEtablissement
                },{
                    text: 'Annuler ',
                    handler: function(){
                        myWin.hide();
                        resetFields();
                        simple.getForm().reset();
    
                    }
                    }]
            });
    This one is working

    Code:
            var simple = new Ext.FormPanel({
                url:'save-form.php',
                id :'simple',
                autoScroll :'auto',
                frame:true,
                title: 'Ajouter Medecin',
                bodyStyle:'padding:5px 5px 0',
                width: 500,
                defaultType: 'textfield',
    
                items: [
                    {
                        fieldLabel: 'Nom',
                        id: 'nomMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },
                    {
                        fieldLabel: 'Prenom',
                        id :'prenomMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },{
                        fieldLabel: 'Secteur',
                        id: 'secteurMedecin',
                        anchor:'100%',
                        allowBlank:false
                    },new Ext.form.ComboBox({
               // store :SpecialiteDataStore,
                displayField:'nomSpecialite', 
                typeAhead: true,
                mode: 'remote',
                triggerAction: 'all',
                selectOnFocus:true,
                fieldLabel: 'Nom',
                id :'put1',
                name : 'nomCab',
                anchor:'100%'
                }),
                    new Ext.form.RadioGroup({
                            fieldLabel: 'Potentiel',
                            vertical: false,
                            id:'potentielMedecin',
                            items: [
                                    {boxLabel: 'A', name: 'pot'+num, inputValue: 'a'},
                                    {boxLabel: 'B', name: 'pot'+num, inputValue: 'b'},
                                    {boxLabel: 'C', name: 'pot'+num, inputValue: 'c'}
                                    ]})
                ],
                buttons: [
                        {
                    text: 'Ajouter medecin ',
                    align :'left',
                    handler: createMedecin
                },{
                    text: 'Ajouter etablissement ',
                    align :'left',
                    handler: addEtablissement
                },{
                    text: 'Annuler ',
                    handler: function(){
                        myWin.hide();
                        resetFields();
                        simple.getForm().reset();
    
                    }
                    }]
            });
    and here is the code of my store :

    Code:
          SpecialiteDataStore = new Ext.data.Store({
                  id: 'SpecialiteDataStore',
                  proxy: new Ext.data.HttpProxy({
                      url: 'database.php',
                      method: 'POST'
                  }),
                  baseParams:{task: "LISTINGSPECIALITE"}, // this parameter is passed for any HTTP request
                  reader: new Ext.data.JsonReader({
                  root: 'results',
                  totalProperty: 'total',
                  id: 'id'
                  },[
                  {name: 'nomSpecialite', type: 'string', mapping :'nomSpecialite'}
                  ])
                  });
    i also want to say that the store is working, i'm using it in a comboBox that is dynamicly added to my formPanel

    Thx for ur answers

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,590
    Vote Rating
    322
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    OK, I've given your code a go and it all seems to work fine for me.

    Here are some things you should try...
    1. Cut back all of the other code apart from the bit that's failing. For example, try removing the buttons and the other form items. Not only can this often provide valuable insight into the nature of the problem but also it is this minimal example that you should be posting to the forums, not your full code. You'll get help much faster that way.
    2. Try running the code in different browsers and let us know what the error messages say. Most browsers have pretty good error logging and debuggers these days, Firefox's Firebug and Chrome's Developer Tools are both very popular. Most will give you the exact line number that the problem occurred on and the chance to jump to that line in the code. Sometimes such messages just take you deep into the bowels of Ext but more often than not there's something in the stacktrace that reveals all.
    3. The only theory I have that fits the behaviour you've described is that SpecialiteDataStore isn't declared at the point you try to use it in your combobox. Is it definitely defined before you try to use it and is that variable in scope? Are you able to log out the value of that variable just prior to using it in the combobox (if you're using Firebug or Chrome then use console.log() or console.dir() to log it out)?

    HTH.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    blacksword888 is on a distinguished road

      0  

    Default


    Thx Skirtle for ur answer , as you said , i tried to use the datastore before i defined it

    it's working now........Have a good day

Thread Participants: 1