PDA

View Full Version : ERROR with SearchField and the error is :me.store.proxy is undefined



lz3404
24 May 2012, 8:10 AM
I'm using searchfield in grid panel, and i got an error :me.store.proxy is undefined:

me.store.proxy is undefined



if (!me.store.proxy.hasOwnProperty('filterParam')) {








at the same time the store status is :store "PresentStore"

this is my store code:


Ext.define('CSMS.store.PresentStore', {
extend : 'Ext.data.Store',
model : 'CSMS.model.PresentModel',

pageSize : 10,
autoLoad : {
start: 0,
limit : 1
},

proxy : {
type : 'ajax',
api : {
read : 'data/present.jsp',
update : 'data/update.json'
},
reader : {
type : 'json',
root : 'present',
successProperty : true,
totalProperty : 'totalCount'
}
}
});


this is my view code:

Ext.Loader.setPath('Ext.ux', 'ExtJs4.1/examples/ux');
Ext.require([
'Ext.data.*',
'Ext.panel.Panel',
'Ext.view.View',
'Ext.layout.container.Fit',
'Ext.toolbar.Paging',
'Ext.ux.form.SearchField'
]);
Ext.define('CSMS.view.PresentView', {
extend : 'Ext.grid.Panel',
alias : 'widget.present',

store : 'PresentStore',

title : 'Present Info',
layout : 'fit',
autoShow : true,

selType : 'cellmodel',
selModel : 'Ext.selection.CheckboxModel',
plugins : [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1
})
],
dockedItems : [
{
xtype : 'pagingtoolbar',
dock : 'bottom',
store : 'PresentStore',
pageSize : 10,
displayInfo : true,
displayMsg : 'display{0}-{1},total{2}',
emptyMsg : 'no data'
},
{
xtype : 'toolbar',
dock : 'top',
items :[
'-',{

xtype : 'button',
text : 'add',
pressed: false,
scale : 'small',
handler: function(){
Ext.widget('editpresent').show();
},
border : '1 1 1 1',
icon : 'images/icons/add.png',
},'-',{
width: 400,
fieldLabel: 'Search',
labelWidth: 50,
xtype: 'searchfield',
store: 'PresentStore',
}
]
}
],

initComponent : function(){
this.columns = [
{
header : 'mobleid,
dataIndex : 'mobileid',
editor : 'textfield',
align : 'center',
width : '100',
resizable : false
},
{
header : 'program,
dataIndex : 'program',
editor : 'textfield',
align : 'center'
},
......
];

this.callParent(arguments);
}
});

Please help me to solve this issue.

mitchellsimoens
26 May 2012, 3:58 AM
The searchfield doesn't resolve the store from the storeId. You will need to give it the store instance and to do that you will need to define it in initComponent.

lz3404
26 May 2012, 4:39 AM
The searchfield doesn't resolve the store from the storeId. You will need to give it the store instance and to do that you will need to define it in initComponent.

Thank you for your answer:),i know your means,but what puzzles me is the 'PresentStore' can work well in pagingtoolbar and grid panel. also, if the searchfield doesn't resolve the store, maybe it would show 'me.store is undefine' error. and i saw the me.store resolved the 'PresentStore' correctly in firbug.

now i'm using the Combobox and jsonP instead of the SearchField.

mitchellsimoens
26 May 2012, 4:40 AM
grid panel and paging toolbar work as they have code to resolve the store, it's not magic. me.store is defined, just is a string.

lz3404
26 May 2012, 4:46 AM
Thank you very much, now i understand.
you are very nice;)

bobamac
28 Jun 2012, 8:43 PM
I'm still confused on how this is fixed. Exact same error as noted above but unsure the correct way to declare the store.

rhytha268
3 Jun 2013, 3:27 AM
Hi bobamac,

it simple you have to define your store by creating instance like - Ext.create('Your store)

leon.wood
25 Aug 2013, 5:45 PM
....
if create in init or in searchfiled it will load twice.

paulineacox
25 Aug 2013, 7:29 PM
hello, thanks for the information dude!

leon.wood
25 Aug 2013, 7:30 PM
I know?
just add

if(!!typeof(me.store.isStore)){
me.store = Ext.data.StoreManager.get(me.store);
}
// We're going to use filtering
me.store.remoteFilter = true;


in searchField source code can resolve it.