ExtJS6: How to set leftpad margin to 0 for treelis

2019-09-15 11:52发布

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

1条回答
时光不老,我们不散
2楼-- · 2019-09-15 12:34

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);
查看更多
登录 后发表回答