PDA

View Full Version : Problem in recovering the value of the combo



gigofizz
11 Jan 2012, 12:31 PM
Picture 1: 30627
Problem in recovering the value of the combo [Marca "Brands", Rubro "Categories", Estado "Status" (boolean)]

VIEW:
---------
/ Products / edit.js :

{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'combo',
name: 'mar_nombre',
fieldLabel: 'MARCA',
store: 'ListBrands',
mode: 'local',
valueField: 'mar_codigo',
displayField: 'mar_nombre',
flex: 1,
labelWidth: 70,
forceSelection : true,
editable : false,
allowBlank: false
},{
xtype: 'combo',
name: 'cat_codigo',
fieldLabel: 'RUBRO',
margins: '0 0 0 6',
store: 'ListCategories',
mode: 'local',
valueField: 'cat_codigo',
displayField: 'cat_nombre',
flex: 1,
labelWidth: 35,
forceSelection : true,
editable : false,
allowBlank: false
}]
},{
xtype: 'fieldset',
title: this.locale.module.products.form.tit2,
layout: 'anchor',
defaults: {
anchor: '100%',
labelStyle: 'padding-left:4px;'
},
items: [{
xtype: 'combo',
name: 'pro_estado',
fieldLabel: 'ESTADO',
labelWidth: 70,
allowBlank: false,
forceSelection: true,
editable : false,
store: 'StatusStore',
queryMode: 'local',
displayField: 'name',
valueField: 'idst',
renderTo: Ext.getBody()
}]
}

/ Products / Grid.js :

{//GRID- RUBRO header: 'Categoria',
dataIndex: 'cat_nombre',
sortable: true,
flex: 1
},{//GRID-STATUS
xtype: 'booleancolumn',
header: 'Estado',
dataIndex: 'pro_estado',
sortable: true,
flex: 1,
falseText: 'Inactivo',
trueText: 'Activo'
}

STORE:
-----------

StatusStore.js
-----------------

//COMBO STATUS
Ext.define('SG.crm.store.StatusStore', { extend: 'Ext.data.Store',
autoLoad: true,
storeId: 'StatusStore',

fields: ['idst', 'name'],
data : [
{"idst":'0', "name":'Inactivo'},
{"idst":'1', "name":'Activo'}
]
});

ListBrands.js
----------------

//COMBO MARCA/BRANDS
Ext.define('SG.crm.store.ListBrands', { extend: 'Ext.data.Store',
storeId: 'ListBrands',
model: 'SG.crm.model.ListBrand',
proxy: {
type: 'rest',
url: '/rest/crm/brands/'
},
autoLoad: true
});



MODEL:
-----------

ListBrand.js
---------------


Ext.define('SG.crm.model.ListBrand', {
extend: 'Ext.data.Model',
idProperty: 'mar_codigo',
fields: [{
name: 'mar_codigo'
},{
name: 'mar_nombre',
type: 'string'
},{
name: 'mar_descripcion',
type: 'string'
},{
name: 'mar_estado'
}],
proxy: {
type: 'rest',
batchActions: false,
url : '/rest/crm/brands/',
reader: {
type: 'json',
root: 'rows',
totalProperty: 'total'
}
}
});



CONTROLLER:
----------------------



stores: ['Products','ListBrands','ListCategories'],
models: ['Product','ListBrand','ListCategorie'],


I can help solve this problem.

Thanks you for your help.

skirtle
11 Jan 2012, 4:27 PM
Posting that much code scares people away from helping you.

It isn't clear what your question is. Could you elaborate a little?

gigofizz
12 Jan 2012, 3:41 AM
The problem is that it shows the value recovered in the combo, I do not list the brands and categories, so it in the status combo (bool 0 and 1) when I edit does not capture the value that I want updated status.
Sorry posting that much code, I did not know how to explain my question.