TreeTableColumn的FXML cellValueFactory [英] FXML cellValueFactory for TreeTableColumn

查看:210
本文介绍了TreeTableColumn的FXML cellValueFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试构建树表并在FXML中定义cellValueFactories.

I've been trying to build a Tree Table and define the cellValueFactories in FXML.

尝试此操作时,在堆栈跟踪中出现以下错误

When I try this, I get the following error in the stack trace

Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: javafx.scene.control.TreeTableColumn$CellDataFeatures cannot be cast to javafx.scene.control.TableColumn$CellDataFeatures

FXML编写如下

<TreeTableView prefHeight="500.0" prefWidth="600.0" fx:id="customerContractsTable">
        <columns>
            <TreeTableColumn prefWidth="116.0" text="Contract Number">
                <cellValueFactory>
                    <PropertyValueFactory property=""/>
                </cellValueFactory>
            </TreeTableColumn>
    </columns>
</TreeTableView>

我一直在寻找有关如何执行此操作的任何文档参考,并且完全是空手而归.任何文档或帮助都将非常有用.

I've been trying to find any documentation references on how to do this and am coming up completely empty handed. Any documentation or help would be greatly apperciated.

推荐答案

这是FXML中的TreeTableView示例.

Here is a sample TreeTableView in FXML.

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.control.TreeTableColumn?>
<?import javafx.scene.control.cell.TreeItemPropertyValueFactory?>

<TreeTableView>
    <columnResizePolicy>
        <TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
    </columnResizePolicy>
    <columns>
        <TreeTableColumn text="Contract Number">
            <cellValueFactory>
                <TreeItemPropertyValueFactory property="contractNumber" />
            </cellValueFactory>
        </TreeTableColumn>
    </columns>
</TreeTableView>

请参见 RT-35233 .

这篇关于TreeTableColumn的FXML cellValueFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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