chasel_zee 2017-02-09 03:01 采纳率: 0%
浏览 2854

Ext.data.JsonStore加载数据时url中怎么带一个变量参数

我要做一个搜索框,根据搜索框中的内容筛选结果:
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”就可以接收到,这样就没有搜索效果了,求大神解决

  • 写回答

2条回答

  • AdvanceWithThe 2017-02-09 07:19
    关注

    这就是说明 var BackgroundPicDisplayName=Ext.getCmp('BackgroundPicDisplayName').getValue(); 你这个变量值得到的就是undefined

    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样