Devexpress TreeList 绑定 方式 速度 优化
2016-08-05 19:23
549 查看
首先考虑代码中的字符串比较是否使用到 "==" 符号,该符号在string的比较中非常耗性能,如果存在则需要全部修改成 "Equal()"
按照如上修改后一般速度有显著飞跃,如果还是很卡,参照如下方法:
Devexrepss Treelist 常用绑定方式有两种:
1.直接treeList.DataSource=dt;
2.使用AppendNode逐条添加
优缺点:
1.绑定方便,但是速度很慢,特别表现在最大化最小化和关闭的时候,巨卡无比
2.绑定复杂,但是速度很快,推荐使用
下面贴出速度较快的第二种参考代码:
TreeListNode parentNode = null;
TreeListNode childNode = null;
treeList.BeginUnboundLoad();
treeList.ClearNodes();
DataView treeDv = dt_F_表二费用表.DefaultView;
DataTable parentDt = null;
DataTable childDt = null;
parentDt = treeDv.ToTable();
foreach (DataRow parentDr in parentDt.Rows)
{
parentNode = this.treeList.AppendNode(new object[] { parentDr["IID"], parentDr["上级费用ID"] }, 0);
treeDv = new DataView(dt_F_表二费用表);
treeDv.RowFilter = "上级费用ID='" + parentDr["IID"].ToString() + "'";
childDt = treeDv.ToTable();
foreach (DataRow childDr in childDt.Rows)
{
childNode = this.treeList.AppendNode(new object[] { childDr["IID"], childDr["上级费用ID"] }, parentNode);
}
}
treeList.EndUnboundLoad();
treeList.ExpandAll();
按照如上修改后一般速度有显著飞跃,如果还是很卡,参照如下方法:
Devexrepss Treelist 常用绑定方式有两种:
1.直接treeList.DataSource=dt;
2.使用AppendNode逐条添加
优缺点:
1.绑定方便,但是速度很慢,特别表现在最大化最小化和关闭的时候,巨卡无比
2.绑定复杂,但是速度很快,推荐使用
下面贴出速度较快的第二种参考代码:
TreeListNode parentNode = null;
TreeListNode childNode = null;
treeList.BeginUnboundLoad();
treeList.ClearNodes();
DataView treeDv = dt_F_表二费用表.DefaultView;
DataTable parentDt = null;
DataTable childDt = null;
parentDt = treeDv.ToTable();
foreach (DataRow parentDr in parentDt.Rows)
{
parentNode = this.treeList.AppendNode(new object[] { parentDr["IID"], parentDr["上级费用ID"] }, 0);
treeDv = new DataView(dt_F_表二费用表);
treeDv.RowFilter = "上级费用ID='" + parentDr["IID"].ToString() + "'";
childDt = treeDv.ToTable();
foreach (DataRow childDr in childDt.Rows)
{
childNode = this.treeList.AppendNode(new object[] { childDr["IID"], childDr["上级费用ID"] }, parentNode);
}
}
treeList.EndUnboundLoad();
treeList.ExpandAll();
相关文章推荐
- MySQL 优化
- Google排名优化的几个影响因素
- DB2优化(简易版)
- Mysql limit 优化,百万至千万级快速分页 复合索引的引用并应用于轻量级框架
- C#中尾递归的使用、优化及编译器优化
- 对优化Ruby on Rails性能的一些办法的探究
- 优化Ruby脚本效率实例分享
- Asp编码优化技巧
- 如何监测和优化OLAP数据库
- mysql -参数thread_cache_size优化方法 小结
- MySQL数据库优化技术之配置技巧总结
- Oracle数据库中SQL语句的优化技巧
- 深入学习SQL Server聚合函数算法优化技巧
- DevExpress获取节点下可视区域子节点集合的实现方法
- DevExpress实现TreeList父子节点CheckState状态同步的方法
- DevExpress实现TreeList向上递归获取公共父节点的方法
- DevExpress设置TreeList图片节点背景色的方法
- MySQL常见的底层优化操作教程及相关建议
- 详解mysql的limit经典用法及优化实例
- 数据库学习建议之提高数据库速度的十条建议