ExtJS6:如何将树列表项的左页边距设置为0
我有一个使用ExtJS6的树形列表,但是由于项目的深度和文本会自动截断,因此第三个子项及更深层会被自动填充.由于我将其用作菜单,因此具有固定的宽度.我需要删除自动计算的左垫边距.在通过extjs api获取treelist时,我没有发现任何有用的东西.谁能帮忙
I have a treelist working using ExtJS6 but since items are left padded automatically given their depth and text inside it gets truncated for third child and deeper. Since I use it as a menu, having fixed width. I need to remove auto calculated leftpad margin. I did not find anything useful while going through extjs api for treelist. Could anyone please help
如果一分钟查看treelist
和treelistitem
的代码以及抽象树列表项,您会发现可以使用未记录的config属性indent:0
或方法setIndent(0)
.
If you look at the code of treelist
and treelistitem
and abstract tree list item for a minute, you see that you can use the undocumented config property indent:0
or the method setIndent(0)
.
不确定为什么未记录它,大概是他们打算在将来的版本中更改命名.
Not sure why it's not documented, presumably they intend to change the naming in future versions.
我通过打开仪表板示例来测试它是否可以正常工作,展开页面"子树,然后将以下行放入浏览器控制台:
I have tested that it's working by opening the dashboard example, expanding the "pages" subtree, and then putting the following line into browser console:
Ext.ComponentQuery.query("treelist")[0].setIndent(0);