需要 Extjs Dataview 的帮助
我尝试使用 ExtJS dataview (TPL),
但效果不佳。我找不到任何错误..
有人知道我做错了什么吗?
代码:
var testPanel = new Ext.Panel({
border: true,
height: 400,
layout : 'fit',
items : [
{html : "Print me"}, // ! It print OK
new Ext.DataView({ // It does not show up!
store: this.store,
itemSelector: 'div.showme',
autoHeight: true,
tpl : new Ext.XTemplate(
'<div>HELLO</div>',
'<tpl for=".">',
'<div class="showme">',
'<div>{myData}</div>',
'</div>',
'</tpl>'
),
emptyText : 'No Data' // even not print this!
})],
store : new Ext.data.JsonStore({
url : '<?php echo url_for('test.php'); ?>', // It bring data ok.
fields : [
{name : 'myData'}
]
}),
redraw : function(para){
this.store.load({
params : {
para : para
}
})
}
});
谢谢!
I'm tring to use ExtJS dataview (TPL)
but it does not working well. and I can not find any wrong..
anybody know what I do mistake?
Code :
var testPanel = new Ext.Panel({
border: true,
height: 400,
layout : 'fit',
items : [
{html : "Print me"}, // ! It print OK
new Ext.DataView({ // It does not show up!
store: this.store,
itemSelector: 'div.showme',
autoHeight: true,
tpl : new Ext.XTemplate(
'<div>HELLO</div>',
'<tpl for=".">',
'<div class="showme">',
'<div>{myData}</div>',
'</div>',
'</tpl>'
),
emptyText : 'No Data' // even not print this!
})],
store : new Ext.data.JsonStore({
url : '<?php echo url_for('test.php'); ?>', // It bring data ok.
fields : [
{name : 'myData'}
]
}),
redraw : function(para){
this.store.load({
params : {
para : para
}
})
}
});
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需将商店放在面板上,您应该将商店直接放在数据视图上。在这一行
store: this.store
中,当您创建对象时,this.store将是未定义的。there is no need to put the store on the panel, you should put the store directly on the dataview. In this line
store: this.store,
when you are creating the object this.store will be undefined.