我要做一个搜索框,根据搜索框中的内容筛选结果:
this.searchPanel = new HT.SearchPanel({
height : 60,
region : 'north',
border : true,
xtype : 'form',
id : 'BackgroundPicDisplaySearchPanel',
frame : true,
items : [{
layout : 'column',
columnWidth : 0.3,
items : [{
layout : 'form',
labelWidth : 40,
columnWidth : .30,
items : [{
xtype : 'textfield',
fieldLabel : '名称',
id : 'BackgroundPicDisplayName',
anchor : '70%',
listeners : {
scope : this,
specialkey : function(field, e) { // 监听enter键事件
if (e.getKey() == Ext.EventObject.ENTER) {
this.onSearch();
}
}
}
}]
},{
layout : 'form',
// labelWidth : 30,
columnWidth : .07,
items : [{
text : "查询",
scope : this,
iconCls : "btn-search",
xtype : "button",
handler : this.onSearch
}]
},{
layout : 'form',
//labelWidth : 120,
columnWidth : .10,
items : [{
text : "清空",
scope : this,
iconCls : "btn-reset",
xtype : "button",
handler : this.reset
}]
}]
}]
});
var BackgroundPicDisplayName=Ext.getCmp('BackgroundPicDisplayName').getValue();
// 加载数据至store
this.store = new Ext.data.JsonStore({
url : __ctxPath +"/commodity/commodityAction!listPic.do?BackgroundPicDisplayName="+BackgroundPicDisplayName,
root : 'result',
totalProperty : 'totalCounts',
remoteSort : true,
fields : ['picId', 'picName', 'picUrl']
});
store是这样写的,onSearch方法如下:
onSearch : function() {
// 验证表单
if (this.searchPanel.getForm().isValid()) {
this.store.reload();
}
}
可是后台接收到的BackgroundPicDisplayName值为undefined,如果将BackgroundPicDisplayName值写成一个固定的值如“aaa”就可以接收到,这样就没有搜索效果了,求大神解决
Ext.data.JsonStore加载数据时url中怎么带一个变量参数
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- AdvanceWithThe 2017-02-09 07:19关注
这就是说明 var BackgroundPicDisplayName=Ext.getCmp('BackgroundPicDisplayName').getValue(); 你这个变量值得到的就是undefined
解决 无用评论 打赏 举报