jQuery EasyUI 树形菜单 – 树形网格动态加载
2023-02-18 15:28:47 时间
jQuery EasyUI 树形菜单 - 树形网格动态加载
动态加载树形网格有助于从服务器上加载部分的行数据,避免加载大型数据的长时间等待。本教程将向您展示如何创建带有动态加载特性的树形网格(TreeGrid)。
![](/wp-content/uploads/2013/12/treegrid3.png)
创建树形网格(TreeGrid)
<table title="Products" class="easyui-treegrid" style="width:700px;height:300px" url="treegrid3_getdata.php" rownumbers="true" idField="id" treeField="name"> <thead> <tr> <th field="name" width="250">Name</th> <th field="quantity" width="100" align="right">Quantity</th> <th field="price" width="150" align="right" formatter="formatDollar">Price</th> <th field="total" width="150" align="right" formatter="formatDollar">Total</th> </tr> </thead> </table>
服务器端代码
treegrid3_getdata.php
$id = isset($_POST['id']) ? intval($_POST['id']) : 0; include 'conn.php'; $result = array(); $rs = mysql_query("select * from products where parentId=$id"); while($row = mysql_fetch_array($rs)){ $row['state'] = has_child($row['id']) ? 'closed' : 'open'; $row['total'] = $row['price']*$row['quantity']; array_push($result, $row); } echo json_encode($result); function has_child($id){ $rs = mysql_query("select count(*) from products where parentId=$id"); $row = mysql_fetch_array($rs); return $row[0] > 0 ? true : false; }
下载 jQuery EasyUI 实例
jeasyui-tree-treegrid3.zip
相关文章
- 带你看清梦饷集团如何成为上海在线新经济四小龙
- Java实战:教你如何进行数据库分库分表
- 教你如何将二进制文件导入到数据库
- 带你了解WDR-GaussDB(DWS) 的性能监测报告
- 支持60+数据传输链路,华为云DRS链路商用大盘点
- 基于用户角色的数据库智能监控系统应用场景分析
- 一招教你数据仓库如何高效批量导入与更新数据
- 关于数据库时区,这么多奥秘你都知道么?
- 详解SQL优化必备:并行执行框架和执行计划
- 在数据库中如何查询表的创建时间?
- 开发者必看!你想知道的迁移之道都在这里了
- 13万张表+数亿行代码,迁移只需数小时,还是异构数据库
- 华为云数据库GaussDB(for Cassandra)揭秘第二期:内存异常增长的排查经历
- 云小课|RDS实例连接又失败?看我祭出杀手锏!
- 通用时区:你应该知道的数据库时区知识
- 云图说|数据仓库服务 GaussDB(DWS) 的“千里眼、顺风耳”—数据库智能运维
- 云图说|初识华为云数据库GaussDB(for openGauss)
- 618 技术特辑(二)几百万人同时下单的秒杀,为什么越来越容易抢到了?
- 云图说|华为云自研云数据库GaussDB NoSQL,兼容多款NoSQL接口的数据库服务
- 想做DBA,多租户管理你一定要知道这些