如何使用树表显示 Oracle SQL 表中的所有行?
我有这张表:
CREATE TABLE perarea ( id_area INT 主键, 名称 VARCHAR2(200), id_areapadre INT 引用 perarea(id_area) );
添加它是为了访问数据:
我的目的是创建一个层次结构,在树视图中显示区域及其下级。然后,当用户单击一个节点时,树表右侧的一个表会加载该区域的所有员工。
首先,我如何填充树表?
谢谢你!
I have this table:
CREATE TABLE perarea
(
id_area INT primary key,
nombre VARCHAR2(200),
id_areapadre INT references perarea(id_area)
);
And this was added to access the data:
My intention is to create a hierarchy showing areas and their subordinates in the treeview. Then when a user clicks a node, have a table on the right of the treetable load all employee from that area.
First thing's first though, how can I populate the treetable?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想到
JTree
作为底层
TreeModel
。TreeModel
,旨在与
org.netbeans.swing.outline.Outline
,说明了分层FileTreeModel
可能会指导您。当您使用 Oracle 时,您可能会找到文章来自数据库查询的动态 JTree< /em> 也很有帮助。附录:文章 了解 TreeModel 也可能会有所帮助。
附录:另请参阅使用
FileTreeModel
的相关示例。It's helpful to think of a
JTree
as a view of the underlyingTreeModel
. An example implementation ofTreeModel
, intended for use withorg.netbeans.swing.outline.Outline
, illustrates a hierarchicalFileTreeModel
that may guide you. As you are using Oracle, you may find the article Dynamic JTree from database query helpful, too.Addendum: The article Understanding the TreeModel may be helpful, too.
Addendum: See also this related example that uses
FileTreeModel
.