如何正确定制Ext JS树节点?
Ext JS 4。我有一个 tree.Panel
,我想在每个节点中显示从该节点的模型数据生成的自定义 HTML。我可以通过在加载商店时设置节点的 text
来做到这一点,但这不是模型的工作来进行标记。因此,我创建了一个自定义 Column
来呈现我的 HTML。
我的问题是:除非我从 Ext.tree.Column 派生,否则它不会正确显示(没有轮廓、加号/减号图标等)。如果我这样做,一切都很好,但是 Ext.tree.Column
被标记为 Ext JS 私有。
是否有一些官方支持的 API 可以实现我想要的功能?
Ext JS 4. I have a tree.Panel
where I want to display custom HTML in each node, generated from that node’s model data. I can do this by setting the node’s text
when loading the store, but it is not the model’s job to do markup. So I created a custom Column
that renders my HTML.
My problem is: unless I derive from Ext.tree.Column
, it doesn’t show up properly (no outline, plus/minus icons etc.). If I do, everything is fine, but Ext.tree.Column
is marked as private to Ext JS.
Is there some officially supported API to do what I want?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我写了一篇关于如何自定义 ExtJS 4 树面板的博文,希望对您有所帮助:
http://hardtouse.com/blog/?p=24
这个想法是使用渲染器结合大量的 css 魔法:
I have written a blog post about how to customize ExtJS 4 tree panel, I hope it will help:
http://hardtouse.com/blog/?p=24
The idea is to use renderer combined with A LOT OF css magic:
谢谢你上面的回答。这是另一个示例,显示了更多格式选项:
您可能还想添加
到树面板配置中,以删除由于使用树列而出现的“网格”标题。
穆雷
Thanks for your answer above. Here is another example showing a few more options for formatting:
You might also want to add
to your tree panel config to remove the "grid" header that appears as a result of using a treecolumn.
Murray