问题
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:
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);
来源:https://stackoverflow.com/questions/38239872/extjs6-how-to-set-leftpad-margin-to-0-for-treelist-items