PDA

View Full Version : grid changed and there is an error



phpwebde
26 Mar 2012, 4:08 PM
the app have a grid and a form and a combox?when i changed to selected the grid ?there is an error
33177


===================================code======
var case_mtstore = Ext.create('Ext.data.Store', {
model: 'case_mtData',
autoLoad: false,
proxy: {
type: 'jsonp',
url: './phps/queryall-mt.php',
reader: {
type: 'json',



Here is the code=================
var case_mtstore = Ext.create('Ext.data.Store', {
model: 'case_mtData',
autoLoad: false, <----when the autoLoad is set to true. error will occure.
proxy: {
type: 'jsonp',
url: './phps/queryall-mt.php',
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount'
}
}
});

var simpleCombo = Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Machine Type',
displayField: 'name',
width: 320,
labelWidth: 130,
name: 'case_mt',
typeAhead:true,
store: case_mtstore,
queryMode: 'remote',
valueField: 'id',
triggerAction: 'all',
});

//cases_form_class
Ext.define('cases.Form', {
extend: 'Ext.form.Panel',
alias: 'widget.cases_form_class',
requires: ['Ext.form.field.Text'],
initComponent: function(){
this.addEvents('create');
Ext.apply(this, {
activeRecord: null,
//width: 600,
border: false,
bodyBorder: false,
bodyStyle:'padding:0 10px 0 0',
fieldDefaults: {
labelAlign: 'left',
labelWidth: 100,
msgTarget: 'side'
},
items: [{
xtype:'tabpanel',
plain:true,
layout:'fit',
activeTab: 0,
defaults:{bodyStyle:'padding:10px'},
items:[simpleCombo]
}); this.callParent();
},
});

var manage_cases_com = Ext.create('Ext.container.Container', {
//padding: '10 10 10 10',//????
padding: '0 0 0 0',
//width: 600,
//height: 1200,
autoScroll:true,
renderTo: document.body,
items: [{//cases_grid_panel
itemId: 'cases_grid_panel',
xtype: 'cases_grid_class',
title: 'Cases Info Lists',
autoScroll : true,
height: 400,
layout:'fit',
store: cases_grid_store,
listeners: {
selectionchange: function(selModel, selected) {
//simpleCombo.store.load();?-----------when the store load(),the error will be occured
manage_cases_com.child('#cases_form_panel').setActiveRecord(selected[0] || null);
}
}
},{//cases_form_panel itemId: 'cases_form_panel',
//layout:'fit',//
padding: '0 10 0 0',
xtype: 'cases_form_class',
layout:'fit',
listeners: {
create: function(form, data){
cases_grid_store.insert(0, data);
}
}
}
]
});

===================
what can i do ?thax very much?any help is greatly appreciated.

mitchellsimoens
27 Mar 2012, 10:04 AM
If you have queryMode set to remote then you should let the combobox manage the store. If you want to load it yourself then you should set it to local.

phpwebde
28 Mar 2012, 2:07 AM
Thank you for your replay.
33235

when the app is first loaded, I click the grid item, and the combox show the value (11) ,but not the name (HP).
but if i click machine type combo once,it will correct.