[英]Ext JS grid panel spacer removal
I am quite new to Ext JS 4 and I have created a Panel with a fixed column. 我是Ext JS 4的新手,并且创建了带有固定列的面板。 There seems to be some kind of bug(as read on some forum) and if I make a column fixed, a spacer (xtype: tbspacer) is automatically inserted at its top, ruining the table's alignment(if it is just a matter of bad configuration, please let me know).
似乎存在某种错误(如在某些论坛上阅读的),并且如果我固定了某个列,则会在其顶部自动插入一个间隔符 (xtype:tbspacer),从而破坏了表的对齐方式(如果这只是一个不好的问题)配置,请让我知道)。 What I would like to do is to remove that spacer.
我想做的是去除该垫片。
In order to do this, I have to select it, but it doesn't have a "static" id, meaning that if I make any modifications to the view, the spacer gets another id, so I need a method to select it without making use of the id. 为此,我必须选择它,但是它没有“静态” ID,这意味着如果我对视图进行任何修改,则间隔器会获得另一个ID,因此我需要一种选择方法而无需利用ID。 I have tried doing something like this:
我试图做这样的事情:
list.query('.tbspacer')[0].setHeight(0);
where list
is the panel. list
是面板。 But it doesn't seem to work. 但这似乎不起作用。 The
list.query()
method returns an empty array. list.query()
方法返回一个空数组。 I get the same issue when trying to select a textfield . 尝试选择文本字段时遇到相同的问题。
Am I missing something, or is it just another bug? 我是否缺少某些东西,还是只是另一个错误?
This is how I create the locked column(nothing special): 这就是我创建锁定列的方式(没什么特别的):
{
header: headerName,
dataIndex: i,
locked: true
}
EDIT Here is also a screenshot: 编辑这也是屏幕截图:
EDIT That spacer shouldn't have existed in the first place, it was(maybe still is?) in that version of the framework. 编辑该间隔符不应该首先存在,在那个版本的框架中(也许仍然存在?)。 See my other question here .
在这里看到我的另一个问题。 I will mark the only answer here as accepted because it seemed to provide a fix to the problem mentioned in this question.
我将这里唯一的答案标记为已接受,因为它似乎可以解决此问题中提到的问题。
First, you're doing a wrong query. 首先,您正在执行错误的查询。 It should be just
tbspacer
, without the dot. 它应该只是
tbspacer
,没有点。 Second, instead of setHeight(0)
, why not just destroy
it? 其次,为什么不
destroy
setHeight(0)
呢?
list.query('tbspacer')[0].destroy();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.