1. #251
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    244
    Vote Rating
    0
    senacle is on a distinguished road

      0  

    Default How to load data in a SuperBoxSelect within a form ?

    How to load data in a SuperBoxSelect within a form ?


    Hello !

    I've red some posts in this thread, i've tried to do what is said somewhere, but i can't do what i want.

    So, i've a SuperBoxSelect inside a form.

    I want to load data into the form.
    When there's multiple datas to put in the
    SuperBoxSelect, i don't know how to do it.

    The
    SuperBoxSelect :

    Code:
                allowAddNewData: true,
                allowBlank:false,
                displayField: 'nom_genre',
                fieldLabel: 'Genre(s) ',
                hiddenName: 'genre[]',
                id:'idjs_genre',
                listeners: {
                    newitem: function(bs,v,f) {
                        v = v +'';
                        v = v.slice(0,1).toUpperCase() + v.slice(1).toLowerCase();
                        var newObj = {
                            id_genre: v,
                            nom_genre: v
                        };
                        bs.addNewItem(newObj);
                    }
                },
                listWidth: 300,
                minChars: 3,
                name: 'genre[]',
                store: store_genre,
                triggerAction: 'all',
                valueField: 'id_genre',
                width: 300,
                xtype:'superboxselect'
    The reader of the form :

    Code:
            reader: new Ext.data.JsonReader({
                root : 'livre',
                fields: ['isbn', 'titre', 'annee', 'numero', 'nb_page', 'prix', 'id_case', 'editeur', 'collection', 'genre', 'auteur']
            }),
    The json data coming from the server :
    Code:
    {"success":true,
    "livre":[{
        "isbn":"INC1230238948371",
        "titre":"Th\u00e9\u00e2tre\/roman (t1)",
        "annee":"1973",
         "numero":"41",
        "nb_page":"410",
        "prix":"0.00",
        "id_case":"29",
        "editeur":"6",
        "collection":"13",
        "genre":"10, 12",
        "auteur":"40"}
    ]}
    As you can see, there's two values for the "genre".

    I think i must have "genre[]" in the json and in the reader, but if so, i've the following error with the reader :

    Code:
    syntax error
    return obj.genre[]
    My question : how to load multiple datas in a SuperBoxSelect ?

  2. #252
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    244
    Vote Rating
    0
    senacle is on a distinguished road

      0  

    Default


    Quote Originally Posted by senacle View Post
    Hello !

    I've red some posts in this thread, i've tried to do what is said somewhere, but i can't do what i want.

    So, i've a SuperBoxSelect inside a form.

    I want to load data into the form.
    When there's multiple datas to put in the
    SuperBoxSelect, i don't know how to do it.

    The
    SuperBoxSelect :

    Code:
                allowAddNewData: true,
                allowBlank:false,
                displayField: 'nom_genre',
                fieldLabel: 'Genre(s) ',
                hiddenName: 'genre[]',
                id:'idjs_genre',
                listeners: {
                    newitem: function(bs,v,f) {
                        v = v +'';
                        v = v.slice(0,1).toUpperCase() + v.slice(1).toLowerCase();
                        var newObj = {
                            id_genre: v,
                            nom_genre: v
                        };
                        bs.addNewItem(newObj);
                    }
                },
                listWidth: 300,
                minChars: 3,
                name: 'genre[]',
                store: store_genre,
                triggerAction: 'all',
                valueField: 'id_genre',
                width: 300,
                xtype:'superboxselect'
    The reader of the form :

    Code:
            reader: new Ext.data.JsonReader({
                root : 'livre',
                fields: ['isbn', 'titre', 'annee', 'numero', 'nb_page', 'prix', 'id_case', 'editeur', 'collection', 'genre', 'auteur']
            }),
    The json data coming from the server :
    Code:
    {"success":true,
    "livre":[{
        "isbn":"INC1230238948371",
        "titre":"Th\u00e9\u00e2tre\/roman (t1)",
        "annee":"1973",
         "numero":"41",
        "nb_page":"410",
        "prix":"0.00",
        "id_case":"29",
        "editeur":"6",
        "collection":"13",
        "genre":"10, 12",
        "auteur":"40"}
    ]}
    As you can see, there's two values for the "genre".

    I think i must have "genre[]" in the json and in the reader, but if so, i've the following error with the reader :

    Code:
    syntax error
    return obj.genre[]
    My question : how to load multiple datas in a SuperBoxSelect ?

    I answer to myself :

    The SuperBoxSelect (no change) :

    Code:
                allowAddNewData: true,
                allowBlank:false,
                displayField: 'nom_genre',
                fieldLabel: 'Genre(s) ',
                hiddenName: 'genre[]',
                id:'idjs_genre',
                listeners: {
                    newitem: function(bs,v,f) {
                        v = v +'';
                        v = v.slice(0,1).toUpperCase() + v.slice(1).toLowerCase();
                        var newObj = {
                            id_genre: v,
                            nom_genre: v
                        };
                        bs.addNewItem(newObj);
                    }
                },
                listWidth: 300,
                minChars: 3,
                store: store_genre,
                triggerAction: 'all',
                valueField: 'id_genre',
                width: 300,
                xtype:'superboxselect'
    The reader of the form (change):

    Code:
            reader: new Ext.data.JsonReader({
                root : 'livre',
                fields: ['isbn', 'titre', 'annee', 'numero', 'nb_page', 'prix', 'id_case', 'editeur', 'collection', {name: 'genre[]', mapping: 'genre'}, {name: 'auteur[]', mapping: 'auteur'}]
            }),
    The json data coming from the server (change):
    Code:
    {"success":true,
    "livre":[{
        "isbn":"INC1230238948371",
        "titre":"Th\u00e9\u00e2tre\/roman (t1)",
        "annee":"1973",
         "numero":"41",
        "nb_page":"410",
        "prix":"0.00",
        "id_case":"29",
        "editeur":"6",
        "collection":"13",
        "genre":"10,12",
        "auteur":"40"}
    ]}
    For the json, be carefull :
    in the first code, there is a space after the coma ("genre":"10, 12"). SuperBoxSelect doesn't recognize the space.
    in the second code, there is no space after the coma ("genre":"10,12")

  3. #253
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Melbourne, Australia
    Posts
    9
    Vote Rating
    0
    markmansour is on a distinguished road

      0  

    Default


    Thank you so much. I really appreciate that you took the time to write this up - you saved me many hours of frustration.

    Quote Originally Posted by boggle View Post
    I've been using this great extension for a while successfully in an EditorGrid.

    Having recently upgraded to 3.3 I found that SuperBoxselect would set the record field value to "".
    After a good few hours tracing the problem it looks like it is because the grid editor tries to call this.field.assertValue() on edit complete if this exists. Since superboxSelect inherits form the combo (which has this method) this gets called.
    The method is unique to combo (not needed on superbox).

    my fix:
    Code:
    Ext.override(Ext.ux.form.SuperBoxSelect, {
       assertValue:null
    });
    (I'd suggest any future release of this include the above property setting)

  4. #254
    Ext JS Premium Member
    Join Date
    May 2010
    Location
    USA
    Posts
    7
    Vote Rating
    0
    istetska is on a distinguished road

      0  

    Default


    devtig
    were you able to implement Superboxselect with combo height for IE 7?
    for some reason you example posted on 30 Nov 2010 7:55 AM only works for FF. do you have any updates?
    thanks!

  5. #255
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    389
    Vote Rating
    13
    devtig will become famous soon enough

      0  

    Default


    I haven't tried IE7 at the time and I haven't since. I did work in FF, IE8 and IE6. 1px too high in Chrome. I don't have new code for you. You're welcome to adjust and post a better version here on the forum. Make sure you test it in the other browsers too before you post here. thanks.

  6. #256
    Sencha User
    Join Date
    Nov 2008
    Posts
    36
    Vote Rating
    0
    gacowarlock is on a distinguished road

      0  

    Default


    I have a problem SuperBoxSelect and pre-selected entries:

    When I set to local and manually load my store, then the available entries get displayed.
    When I set to remote, then I get a not ending number of server requests but get the pre-selected entries correctly. In this mode, it's not possible to see the list of available entries...
    What am I doing wrong?

    Here's my code:

    Code:
    PN.form.SubsidiaryComboBox = Ext.extend(Ext.ux.form.SuperBoxSelect, {
    
        displayField: 'shortname',
        valueField: 'id',
        mode: 'remote',
        triggerAction: 'all',
        editable: false,
        queryValuesDelimiter: ',',
    
        constructor: function(config) {
            this.store = new PN.data.JsonStore({
                modelName: 'subsidiary'
            });
            
            // Disable autosave
            this.store.autoSave = false;
            
            // Preload the store
            this.store.load();
            
            PN.form.SubsidiaryComboBox.superclass.constructor.call(this, config);           
        },
    My SuperBoxSelect.js is original and not modified.

    Please see the attached screenshot for details.

    Hoping for help...

    gacowarlock
    Attached Images

  7. #257
    Sencha User
    Join Date
    Apr 2011
    Posts
    1
    Vote Rating
    0
    tvelykyy is on a distinguished road

      0  

    Question SuperBoxSelect filled with initial values receives focus after page loads

    SuperBoxSelect filled with initial values receives focus after page loads


    SuperBoxSelect filled with initial values receives focus after page loads. I want to get rid of this focus. Have that can be done.

    P.S. I'm quite newby, so don't judge me strong. I'm just learning.

  8. #258
    Sencha User
    Join Date
    Mar 2007
    Posts
    464
    Vote Rating
    1
    JorisA is on a distinguished road

      0  

    Default


    Oeeeeeweee, any plans on updating it for Ext4? This is the awesomest input field ever!

  9. #259
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    I was hoping that ExtJS 4 will include any form of multiselect input field but it doesn't

  10. #260
    Sencha User
    Join Date
    Jun 2011
    Posts
    1
    Vote Rating
    0
    revertTS is on a distinguished road

      0  

    Default


    The @license in SuperBoxSelect.js lists it as TBA; is this still the case?

Thread Participants: 94

  1. Animal (3 Posts)
  2. jay@moduscreate.com (1 Post)
  3. Condor (1 Post)
  4. stever (1 Post)
  5. mystix (5 Posts)
  6. MD (1 Post)
  7. JorisA (1 Post)
  8. randomY (1 Post)
  9. DigitalSkyline (1 Post)
  10. sj137 (3 Posts)
  11. boggle (1 Post)
  12. danh2000 (71 Posts)
  13. ostghost (1 Post)
  14. lossendae (1 Post)
  15. ZooKeeper (1 Post)
  16. greco (1 Post)
  17. Fredric Berling (1 Post)
  18. GraemeBryce (2 Posts)
  19. Strati (2 Posts)
  20. syscobra (2 Posts)
  21. boonkerz (4 Posts)
  22. Sesshomurai (3 Posts)
  23. shamansoft (1 Post)
  24. dorgan (2 Posts)
  25. mjhaston (1 Post)
  26. radtad (5 Posts)
  27. Joyfulbob (2 Posts)
  28. crysfel (1 Post)
  29. armandoxxx (2 Posts)
  30. jarlau (1 Post)
  31. lacco (1 Post)
  32. abraxxa (38 Posts)
  33. prometheus (1 Post)
  34. pops (1 Post)
  35. raphac (1 Post)
  36. Scorpie (2 Posts)
  37. supercharge2 (4 Posts)
  38. jmiguel (2 Posts)
  39. ash11tw (2 Posts)
  40. wojan (1 Post)
  41. ryzmen (1 Post)
  42. nmohler (2 Posts)
  43. wki01 (2 Posts)
  44. gacowarlock (1 Post)
  45. kora.kanchan (1 Post)
  46. senacle (3 Posts)
  47. genie_vn (1 Post)
  48. sergey.s (1 Post)
  49. Grolubao (10 Posts)
  50. mathec (1 Post)
  51. jackjia (1 Post)
  52. polydyne (1 Post)
  53. Antjac (1 Post)
  54. Thomas Triplet (1 Post)
  55. Gonfi (1 Post)
  56. kleins (1 Post)
  57. talha06 (1 Post)
  58. scishop (1 Post)
  59. eztam (2 Posts)
  60. frederickd (10 Posts)
  61. dusoo (2 Posts)
  62. iv_ekker (3 Posts)
  63. pym (1 Post)
  64. sudhirhv (3 Posts)
  65. lanhun (14 Posts)
  66. wcasado (1 Post)
  67. ramana_l_v (3 Posts)
  68. cq.yangyu@gmail.com (1 Post)
  69. siberian (1 Post)
  70. Tommi (4 Posts)
  71. rdblyth (2 Posts)
  72. devtig (3 Posts)
  73. markmansour (1 Post)
  74. dhiren.lodhia (1 Post)
  75. slamhan (1 Post)
  76. panter4 (1 Post)
  77. Korbin (2 Posts)
  78. istetska (1 Post)
  79. ian.young (1 Post)
  80. sebterzi (1 Post)
  81. ucoxk (1 Post)
  82. prakashr (1 Post)
  83. danilo.pederiva (1 Post)
  84. --miCZar-- (2 Posts)
  85. zozofoz (1 Post)
  86. spydercavern (1 Post)
  87. tvelykyy (1 Post)
  88. leorossi (3 Posts)
  89. revertTS (1 Post)
  90. joxzaren (1 Post)
  91. leduc (1 Post)
  92. deepthi_r (1 Post)
  93. qiankun (1 Post)
  94. Mr.Solomon (2 Posts)