Results 1 to 5 of 5

Thread: combobox with multiselect from json store

  1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    212
    Answers
    3

    Default Answered: combobox with multiselect from json store

    hi,

    i have a combobox:

    PHP Code:
    Ext.define('sectors', {
        
    extend'Ext.data.Model',
        
    fields: ['id','sector']
    });

    var 
    sectores_Store Ext.create('Ext.data.JsonStore', {
      
    autoLoadtrue,
      
    model'sectors',
      
    proxy: {
        
    type'ajax',
        
    api: {
            
    read 'data/sectors.php?action=getsectors'
        
    },
        
    reader: {
                
    type'json',
                
    root'sectors'
         
    }
      }
    });

    var 
    sectors_Combo = new Ext.form.ComboBox({
                
    triggerAction'all',
                
    name'sector',
                
    fieldLabel'Branche',
                
    emptyText'Branche',
                
    multiSelecttrue,
                
    mode'SIMPLE',
                
    storesectores_Store,
                
    allowBlankfalse,
                
    queryMode'local',
                
    displayField'sector',
                
    valueField'id',
                
    bubbleEvents: ['change'],            
                
    listClass'x-combo-list-small',
                
    editablefalse
            
    }); 

    now i can select multiple values in my form.

    But i want to send it to my php backend and save the value in a mysql table.

    So it saves the value ids like this "3,6,10".

    No when i load again the form, in this combo it shows only "3,6,10" and NOT the real value?

    What should i do?

  2. do this in PHP
    PHP Code:
     $multiselect_array preg_split('/,/'$splitTHIS'-1'PREG_SPLIT_NO_EMPTY); 
    send $multiselect_array instead of the string from the database

  3. #2
    Sencha User
    Join Date
    Jan 2008
    Posts
    212
    Answers
    3

    Default

    is this not possible to have a multiselect combo on a form?

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Are you sending the values to the combo as an array or string?
    http://www.sencha.com/forum/showthread.php?263908

  5. #4
    Sencha User
    Join Date
    Jan 2008
    Posts
    212
    Answers
    3

    Default

    as string, in db there is value like '2,3,5'

  6. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    34
    Answers
    4

    Default

    do this in PHP
    PHP Code:
     $multiselect_array preg_split('/,/'$splitTHIS'-1'PREG_SPLIT_NO_EMPTY); 
    send $multiselect_array instead of the string from the database

Posting Permissions

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