ExtJS6:如何将树列表项的左页边距设置为0 [英] ExtJS6: How to set leftpad margin to 0 for treelist items

查看:136
本文介绍了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

推荐答案

如果一分钟查看treelisttreelistitem的代码以及抽象树列表项,您会发现可以使用未记录的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);

这篇关于ExtJS6:如何将树列表项的左页边距设置为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆