View Full Version : Ext.ux.form.LovCombo - canīt setValues...

22 Nov 2009, 3:38 PM
Hi There,
I use Sakiīs Ext.ux.form.LovCombo as Multiselect ComboBox.
Loading the store and submitting the form already works fine - but I still have problems to use setValue() when showing a different displayField the the valueField...

Below a little code snippet that does not work for me...
When using "catID" instead of "catTitle" as displayField - everything works fine (except that I then have ugly numbers instead of the category titles in my combo...)

Any ideas?
Kind regards

new Ext.FormPanel({
,defaults: {layout: 'form'}
,items: [{
id: 'lovcombo'
,xtype: 'lovcombo'
,fieldLabel: 'Kategorie/n'
,store: new Ext.data.JsonStore({
url: 'php/getCategories.php',
baseParams: {
task: "readCats",
serviceTypID: serviceTypID
root: 'results',
id: 'catID',
fields: ['catID', 'catTitle']
,hiddenName: 'catID'
,hiddenValue: 'catID'
,displayField: 'catTitle'
,buttons: [{
text: 'SetValues'
,handler: function() { Ext.getCmp('lovcombo').setValue('15,20');}

22 Nov 2009, 3:50 PM
Ah.... I just found the solution: again some strange php-json-js interaction....
When collecting the data from the database and converting it to json with the php json_encode() function, integers are being converted to strings e.g. 2 -> "2"

Thats why the setValue() function failed.

I now do a (float)$rec['id']; before converting the array to json and see - it works!!!

22 Nov 2009, 4:19 PM
There still remains one problem....
How can I assign the values when loading the form?
I tried with different listeners - but none of them worked - the only thing that works for me is the "SetValues"-Button as shown above.

I just want the actual applicable items to be checked when opening the form.

22 Nov 2009, 4:25 PM
Sorry to monogolize in this thread - but it seems that posting here makes me think... :D
The solution was to put the setValue() function in the store onLoad listener. This makes sure that all applicable categories are loaded and can be assigend...

I just put that into my store:

listeners: {
load : function() { Ext.getCmp('lovcombo').setValue(cats); }

11 Aug 2011, 12:02 AM
Hi friend:):
In the use of LovCombo, I use setValue () for LovCombo setValues, why can't setValues? Key code as follows:

this.loadRoleComboxValuesByType = function() {
var roleType = sma.getSelected().get("roleType");
var roles = Ext.data.Record.create([{
name : 'roleId',
mapping : 0
}, {
name : 'roleName',
mapping : 1
var reader = new Ext.data.ArrayReader({id:0},roles);
var cstore = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : Main.ContextPath + '/operates/roleInstall!getJsonRolesByType.action?roleType='+roleType
reader: reader
return cstore;

new Ext.FormPanel({
labelWidth : 75,
labelAlign: 'right',
frame : true,
bodyStyle : 'padding:5px 5px 5px 5px',
width : 350,
defaults : {
width : 230
items : [{
xtype:'lovcombo', //?????
fieldLabel: '??',
name : 'roles',
hideOnSelect : true,
/*store : new Ext.data.SimpleStore({
fields : ['roleId', 'roleName'],
data : [['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']]
}),*/ /*When I use Ext.data.SimpleStore?can setValues!*/
store:this.loadRoleComboxValuesByType(), // ?????????
valueField : "roleId",
displayField : "roleName",
triggerAction : 'all',
mode : 'local'

Sorry, my English is not good, maybe not clear about of the description!If you can do for me to solve this problem, I really appreciate it!??;)?