【发布时间】:2015-04-04 11:47:20
【问题描述】:
我正在使用此代码:
grid.render('grid');
Ext.getCmp('grid').mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
根据文档
emptyText : 字符串 当没有可用行时,默认文本(接受 html 标记)显示在网格主体中(默认为 '')。此值将用于更新 mainBody:
this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
对我来说它显示
无法读取未定义的属性“更新”
请帮忙
【问题讨论】:
-
什么是
this?我们可能需要更多代码才能继续,但看起来this不包含mainBody的定义 -
我正在尝试这个,但后来我知道了 deferEmptyText : false 和 emptyText :'no data found' ..... 需要在 viewConfig{} 中写入它们。
-
向我们展示您的
grid课程,以解释此错误背后的原因。只能通过你上面放的那段代码说mainBody没有引用渲染对象。