javascript - ExtJs 4 MultiSelect Edit Form doesn't load selections -



javascript - ExtJs 4 MultiSelect Edit Form doesn't load selections -

i need help combo box multiple select in extjs 4.

i need in forms simple manytomany relation splitted central table:

user -< user_group >- group.

where:

user: id, name, year

user_group: user_id, group_id

group: id, name

i have no problem in creation form of user , can save databse php groups i've associated combobox.

now, have grid users, , when seek start edit 1 of them, selections of combobox not loaded, combobox's field show ids of corrected selections.

for example:

when seek edit user (json code)

{ "id": 86, "name": "tempname", "year": 1492, "groups_id": [1,2,3] }

the edit form filled info , field of combobox shows 1,2,3 , nothing selected in dropdown menu.

this combobox:

{ xtype: 'combobox', multiselect: true, name: 'groups_id', fieldlabel: 'group/s', valuefield: 'id', displayfield: 'name', store: 'groups', allowblank: false }

so, why nil getting selected on load of thtat form? , why ids pass load combobox (groups_id) not getting bind it? it's wrong json construction of user?

i've passed 2 days on this...and yes...i'm pretty new extjs ;)

ok managed things working after sandwiches.

the problem that, when loading record edit, record.get('groups_id') array of string (for illustration ["1","2","3"]) while i need array of integer (like [1,2,3]).

to convert/parse record.get('groups_id') made this:

//from [ "1" , "2" , "3"] [ 1 , 2 , 3] //preparing empty array parsed ids var ids_integer = new array(); //one one, string int record.get('groups_id').foreach( function(id){ ids_integer.push(parseint(id)); }); //sobstitute string array int array record.set('groups_id', ids_integer); var view = ext.widget('useredit'); view.down('form').loadrecord(record); //finally load record in form

javascript php extjs combobox multi-select

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -