我正在尝试创建可编辑的树窗口小部件。 有许多示例如何为Table创建可编辑的列,例如使用cellrenderer和propertyCellRendererFactoryFunc - 这非常棒。 不幸的是我找不到任何有用的VirtualTree / Tree示例。 是否有可能在没有深层Tree源代码编辑的情况下创建一个?
I am trying to create editable tree widget. There are many samples how to make editable columns for Table, for example by using cellrenderer and propertyCellRendererFactoryFunc - which is quite awesome. Unfortunately I can't find any useful example for VirtualTree/Tree. Is it even possible to create one without deep Tree source code editing?
最满意答案
这是VirtualTree的一种方法:
VirtualTree为树项使用普通小部件,因此我们的想法是设置这些项的创建方式,以便修改它们的外观。 这是通过代表实现的。 使用tree.setDelegate()在树上设置自定义委托。 委托本身可以是本机JS对象(map)。 它必须符合IVirtualTreeDelegate接口 ,这意味着委托对象从预定义的集合(如'bindItem','createItem',...)中公开一些方法。 有关一般示例,请参阅此演示的代码。 在您的情况下,您希望在委托中提供createItem方法以及任何其他支持方法(例如bindItem )。 有一个更复杂的例子可以做到这一点,它使用自身的一个实例作为委托。HTH
Here is one approach for VirtualTree:
VirtualTree uses normal widgets for the tree items, so the idea is to taylor the way these items are created, in order to modify their appearance. This is achieved through a delegate. Use tree.setDelegate() to set a custom delegate on a tree. The delegate itself can be a native JS object (map). It has to conform to the IVirtualTreeDelegate interface, meaning the delegate object exposes some methods from a predefined set (like 'bindItem', 'createItem', ...). See the code of this demo for a general example. In your case, you want to provide a createItem method in your delegate, along with any other supporting methods (e.g. bindItem). There is a somewhat more complicated example that does that, which uses an instance of itself as the delegate.HTH
Qooxdoo - “VirtualTree”并且缺少“cellrenderer”(Qooxdoo - “VirtualTree” and missing “cellrenderer”)我正在尝试创建可编辑的树窗口小部件。 有许多示例如何为Table创建可编辑的列,例如使用cellrenderer和propertyCellRendererFactoryFunc - 这非常棒。 不幸的是我找不到任何有用的VirtualTree / Tree示例。 是否有可能在没有深层Tree源代码编辑的情况下创建一个?
I am trying to create editable tree widget. There are many samples how to make editable columns for Table, for example by using cellrenderer and propertyCellRendererFactoryFunc - which is quite awesome. Unfortunately I can't find any useful example for VirtualTree/Tree. Is it even possible to create one without deep Tree source code editing?
最满意答案
这是VirtualTree的一种方法:
VirtualTree为树项使用普通小部件,因此我们的想法是设置这些项的创建方式,以便修改它们的外观。 这是通过代表实现的。 使用tree.setDelegate()在树上设置自定义委托。 委托本身可以是本机JS对象(map)。 它必须符合IVirtualTreeDelegate接口 ,这意味着委托对象从预定义的集合(如'bindItem','createItem',...)中公开一些方法。 有关一般示例,请参阅此演示的代码。 在您的情况下,您希望在委托中提供createItem方法以及任何其他支持方法(例如bindItem )。 有一个更复杂的例子可以做到这一点,它使用自身的一个实例作为委托。HTH
Here is one approach for VirtualTree:
VirtualTree uses normal widgets for the tree items, so the idea is to taylor the way these items are created, in order to modify their appearance. This is achieved through a delegate. Use tree.setDelegate() to set a custom delegate on a tree. The delegate itself can be a native JS object (map). It has to conform to the IVirtualTreeDelegate interface, meaning the delegate object exposes some methods from a predefined set (like 'bindItem', 'createItem', ...). See the code of this demo for a general example. In your case, you want to provide a createItem method in your delegate, along with any other supporting methods (e.g. bindItem). There is a somewhat more complicated example that does that, which uses an instance of itself as the delegate.HTH
发布评论