如何使用树表显示Oracle SQL表中的所有行? [英] How can I use a treetable to show all rows in an Oracle SQL table?

查看:169
本文介绍了如何使用树表显示Oracle SQL表中的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这张桌子:

创建表区域 ( id_area INT主键, 标称VARCHAR2(200), id_areapadre INT引用perarea(id_area) );

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?

谢谢!

推荐答案

考虑 TreeModel ,用于 FileTreeModel 可能会指导您.使用Oracle时,您可能会发现文章 来自数据库查询的动态JTree 也很有帮助.

It's helpful to think of a JTree as a view of the underlying TreeModel. An example implementation of TreeModel, intended for use with org.netbeans.swing.outline.Outline, illustrates a hierarchical FileTreeModel that may guide you. As you are using Oracle, you may find the article Dynamic JTree from database query helpful, too.

附录:文章 了解TreeModel 可能也会有所帮助.

Addendum: The article Understanding the TreeModel may be helpful, too.

附录:另请参见使用FileTreeModel的此相关示例.

Addendum: See also this related example that uses FileTreeModel.

这篇关于如何使用树表显示Oracle SQL表中的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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