View Full Version : combobox with multiselect from json store

8 Jan 2015, 6:12 AM

i have a combobox:

Ext.define('sectors', {
extend: 'Ext.data.Model',
fields: ['id','sector']

var sectores_Store = Ext.create('Ext.data.JsonStore', {
autoLoad: true,
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',
multiSelect: true,
mode: 'SIMPLE',
store: sectores_Store,
allowBlank: false,
queryMode: 'local',
displayField: 'sector',
valueField: 'id',
bubbleEvents: ['change'],
listClass: 'x-combo-list-small',
editable: false

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?

12 Jan 2015, 3:10 AM
is this not possible to have a multiselect combo on a form?

Gary Schlosberg
12 Jan 2015, 9:52 AM
Are you sending the values to the combo as an array or string?

12 Jan 2015, 10:52 AM
as string, in db there is value like '2,3,5'

13 Jan 2015, 12:23 AM
do this in PHP
$multiselect_array = preg_split('/,/', $splitTHIS, '-1', PREG_SPLIT_NO_EMPTY); send $multiselect_array instead of the string from the database