请选择 进入手机版 | 继续访问电脑版
虚位以待    招租QQ:244594752    尺寸:960x60
终身VIP需技术指导请加(官方QQ :244594752 )
加入我们,终身VIP只需159元,全站下载(老客户请联系我补差价即可升级)
查看: 1019|回复: 82

EasyUiTreeGrid封装控件源码(三级联动+数据字典)

  [复制链接]

该用户从未签到

2275

主题

2307

帖子

8051

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
8051
发表于 2018-3-17 23:13:19 | 显示全部楼层 |阅读模式
树型实体的抽象与封装
  所谓树型实体,就是具有树型结构关系的实体,比如省、市、区。对于初学者,可能会创建三张表进行存储,有经验的开发者通过引入ParentId将设计简化为一张表,但是基于ParentId的设计也不够完美,主要问题是查找某个节点的所有上级或所有下级时,都需要进行递归,这是一个低效而复杂的操作。
  更有经验的开发者会引入物化路径Path,物化路径是对节点关系的记录,一般格式为:当前节点Path = 父节点Path + 当前节点Id + “,”,注意物化路径的最后一定是某个符号,一般为逗号。
  一旦物化路径设置完成,查找所有上级和下级就非常简单,查找所有上级只需要从当前节点的Path中,用逗号分隔出Id即可,查找所有下级,通过StartsWith查询Path列,也就是Sql中的Like ‘xxx%’。
  虽然物化路径在查询节点关系方面非常高效,但也不是没有成本的,主要成本在于修改节点关系之后,该节点的所有下级节点的物化路径都需要更新。比如某个节点修改了父节点,那么除了当前节点的Path需要更新外,它的所有下级节点也需要更新,这是一个代价高昂的操作。想像一下,当一个节点下面有数千个,甚至数万个节点,修改一下节点关系将带来多么严重的后果。不过一般树型结构的数据量都不会很大,所以这个问题也不用太多考虑,你只需要了解用这种设计方案有什么弊端即可。
  当使用了EasyUi的TreeGrid这种控件以后,可以在表格上随意编辑和修改,甚至可以通过拖拽的方式修改父节点,仅在最后一刻进行保存,而保存的时候使用工作单元DbContext进行操作,这时候你会发现物化路径的更新将是一个非常棘手的问题。
  树型结构也有规律可循,甚至TreeGrid上的操作都可以进行抽象,我在领域层定义了ITreeEntity、TreeEntityBase、ITreeEntityQuery、TreeEntityQuery等几个类和接口,应用层定义ITreeBatchService、TreeBatchService,表现层定义基控制器TreeGridControllerBase。通过这几个类进行抽象,树型结构的基本操作都内置到框架中,业务类通过继承基类就完成了大部分工作。
  值得一提的是, TreeGridControllerBase提供了一个加载模式LoadMode,默认为异步加载模式,每次只查询一级节点。具体控制器通过重写加载模式,可以切换为同步加载,即一次加载全部节点,另外还提供了一种根节点异步加载模式,即根节点异步加载,下级节点同步加载,通俗的说就是第一次只加载根节点,点击根节点查询出全部子节点。当然,这些功能都不需要你手写代码,全部内置。
  由于本篇只是简介,后续文章再详细介绍。
EasyUi TreeGrid抽象与封装
  对于树型实体的编辑操作,一般可以使用Tree控件,再配合一个表单或表格进行,但TreeGrid是更好的选择。
  Easyui treegrid 有很多小bug,比如getChanges方法获取的结果不正确,分页总行数错误等,这些问题都需要自己解决。
  我对treegrid的封装,除了修复一些bug外,另外对树型表格上的操作进行了抽象,将基本操作都内置到框架中。
  大体功能如下:
1.表格编辑
2.添加根节点
3.添加下级节点
4.插入同级节点(上方)、
5.插入同级节点(下方)
6.自动创建连续的排序号(服务端+客户端配合完成)
7.上移
8.下移
9.拖拽排序
10.修正排序号
11.拖拽修改父节点
12.限制可拖拽的层级
13.批量修改,一次保存
14.冻结节点
15.启用节点
16.支持不同加载模式
?同步加载模式
?异步加载模式
?根节点异步加载模式
  17. 支持对根节点(第一级节点)分页
  18. 支持查询时显示所有上级节点
  19. 支持右键菜单

  对于表格上的编辑操作,我是用官方提供的edatagrid扩展,复制了一份来改造的,拖拽使用的是官方提供的treegrid.dnd扩展,也简单改了下 。
  关于easyui的性能,如果使用datagrid控件很慢,一般是因为没有设置列宽,这是必须设置的,不然奇慢。Treegrid虽然从datagrid控件派生,但行为上很多不同,datagrid操作行索引index,而treegrid操作的是id。
  我在封装treegrid的时候发现,40个节点左右,treegrid提供的所有操作id的方法都非常慢,断点调试能明显感觉卡一下。由于没有源码,无法调优,所以你在使用我提供的拖拽排序和修正排序号这些功能时,发现性能很差不要惊讶,为何纯客户端操作会如此之慢,那是easyui底层的问题,因为需要调用它的相关方法。
  至于你担心我封装的服务端控件解析可能存在性能问题,一般不需要太紧张,我目前没有考虑性能,一旦服务端控件解析成为性能瓶颈,我会优化它。
  另外一点,由于是一次性保存,可能会批量更新很多节点,对此我没有进行性能优化,使用的是EF的对象一个个的更新,可能会比较慢,不过考虑到这些操作一般是管理员干的,慢一点就让他忍忍好了。
  封装以后,业务代码就非常简单了。
115100280107074.jpg
游客,如果您要查看本帖隐藏内容请回复

回复

使用道具 举报

该用户从未签到

0

主题

180

帖子

366

积分

禁止发言

积分
366
发表于 2018-8-23 09:30:38 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

匿名  发表于 2019-10-31 10:50:28
prilosec otc coupon acid reflux medicine omeprazole omeprazole alcohol <a href="http://omeprazoleprilosecjg.com/#">omeprazole generic name</a> protonix vs prilosec
回复 支持 反对

使用道具

匿名  发表于 2019-11-1 04:07:39
is losartan recalled is losartan an ace inhibitor cozaar drug class <a href="http://losartancozaarhyzaarst.com/#">losartan brand name</a> losartan recall 2019
回复 支持 反对

使用道具

匿名  发表于 2019-11-1 05:18:55

tips to write essay in english

УОН 46.119.127.x ·±нУЪ 2019-10-31 10:50
prilosec otc coupon acid reflux medicine omeprazole omeprazole alcohol omeprazole generic name proto ...

Jameson Thomas from Athens-Clarke County was looking for tips to write essay in english

Shaquille Fletcher found the answer to a search query tips to write essay in english




tips to write essay in english






























vom sinnlichen eindruck zum symbolischen ausdruck philosophische essays
youth pastor resume objective
write cheap school essay on shakespeare
type my music creative writing
thesis topic in community medicine
top case study writer sites for mba
top cover letter proofreading websites online
www military to civilian resume com
top cv writing service us
top assignment editing for hire for phd
toolwire lab homework
used video game store business plan
write a jingle
tips for writing descriptive essays
top thesis statement ghostwriting for hire ca
write me culture annotated bibliography
title page mla style essay
war of 1812 necessary essay
thesis proposal writer site gb
top school essay editor websites ca
top dissertation proposal editor site for college
urgent essays co uk
top creative essay ghostwriters for hire for phd
using bullets in cover letter
vanderbilt resume knoxville tn
top home work writer services for phd
walmart courtesy associate resume
toefl essay structure
xml resume dtd
thesis topics on applied linguistics
utorrent resume deleted torrent
thesis statement about only children
top case study ghostwriter website gb
top college report samples
thesis topic outline sample
top cheap essay writers for hire for university
top creative essay
top definition essay writer services au
with homework online
top thesis proposal editor services
thesis visual design template editor
walter pater essays on literature and art
writing literary essay tips
thesis shopp
top university essay proofreading website for mba
top custom essay writers site au
top admission paper ghostwriters service uk
type my shakespeare studies content
top article writer service us
why don't i do my homework
write a value proposition statement
walden rhetorical analysis essay
top letter ghostwri
winesburg ohio godliness essay
回复 支持 反对

使用道具

匿名  发表于 2019-11-1 05:19:48

how to write a compensation letter

Rohan Hanson from Youngstown was looking for how to write a compensation letter

Darian Burke found the answer to a search query how to write a compensation letter




how to write a compensation letter






























healthcare administration cover letter
holden essay for stradlater
how to write a creative writing essay
how can i write a service in delphi 7
how to write a cd using nero burning rom
how to build a homework machine
hegelian dialectics thesis
integrated essay samples toefl ibt
how to write greater than or equal to
health science research papers
how to write a hook for an argumentative essay
introduction and thesis statement help
how to write a good cover letter for work experience
help with my esl blog online
how to write a case study for ofsted
how to network a resume
how to write cv for investment banks
how to write date of birth
help me write cheap book review online
help writing literature paper
how to write up procedures
how to write a screenplay pdf
help with  persuasive essay
how to write a good campaign speech for treasurer
how does technology affect our lives essay
holocaust research paper grade 7
homework help english ballad
how to write a memberal speech
help with my english as second language article
how to write a blurb for a picture book
how to write long copy that makes money
how to write a reserant reveiw
it business analyst cover letter sample
how to write an introduction for newsletter
insurance broker business plan template
interactive wittgenstein essays in memory of georg henrik von wright
how to write a technical report for a project
i attach resume to this letter
how to write a navy sop
interior architecture thesis ideas
help with my geography report
how to write your home address
help with  investments dissertation chapter
i want to write my state senator a letter
how to write sat essay step by step
j2ee resume singapore
history extension essays
homework focus for 4th grader
how to write a health and safety policy statement
help me write a ballad
hobbies and interests on resume examples
how to write a letter of recognition
is she doing her homework
how to write exam questions
help with  esl creative essay on trump
how to write an autoresponder series
how to write a personal recommendation letter
how to write a good blurb about yourself
how to put bibliography in research paper
how to write in demotic
hillary rodham resume
help me write marketing annotated bibliography
回复 支持 反对

使用道具

匿名  发表于 2019-11-1 05:23:46

jaws essay english

Freddy Snyder from Houston was looking for jaws essay english

Dallas Newton found the answer to a search query jaws essay english




jaws essay english






























how to write introduction of a project report
homework sorrentino
how to write greek myth
how to write introductory speech
help me write popular academic essay online
job listing resume cover letter apply include
iris recognition system+thesis
how to write an introduction paragraph in a persuasive essay
help writing environmental studies dissertation introduction
job resume listings
ibm websphere commerce resume
help with  journali
help writing cheap dissertation results online
jose galvan writing literature review
how to write a bebop tune
homework program id
how to write wedding shower thank you notes
how to write in adobe acrobat 9 pro
healthcare it resume objective
humorist essays
how to write a calculator program in html
intitle resume c vista api algorithm
help writing blues lyrics
keywor online e resume
how to write a dynamic data into a word file using php
help desk consultant resume
iron deficiency anemia essay
how to write an interpretive essay outline
how to write a bio for public speaking
how do you referenc
how to write referencing
how to write 1 03m
how to write out fractions
law school admission resume format
how to write action plan
interoffice job application cover letter
how to write amin in arabic
how to write case study analysis
ielts band 9 writing book pdf
highest paying jobs for writers
j alfred prufrock essay questions
homework ru
how to write impressive essay in hindi
how to edit a research paper
law and justice essay
how to write comic
how to write an opinion piece
how to write invitation for housewarming
how to write the letter t in calligraphy
holocaust denial thesis
how to write a cover letter of a job
how to write konnichiwa in japanese
historical fiction book report
help with  professional reflective essay on brexit
how to write a greeting card message
how do you write a constitution
heroes essay
help with  custom best essay on usa
how to write a apa formated research paper samples images
international essay competition december 2012
help with  philosophy thesis
how to write connection string in c
how to write a business plan for catering business
how to write sql query in classic asp
how to write html program in netbeans
how to write a table of context
how to write an introduction for a magazine article
help with  popular best essay on hillary clinton
hermaphrodite research paper
how to write an essay about survival
how to write a great cv template
help writing economics dissertation methodology
how to write a veterinary prescription
high school job resume
importance dreams mice men essay
how to write dictionary
how to quote a book in an essay examples
intermediate 2nd year model papers 2009
how to write great descriptive essays
how to write on a balloon
hvac design resume format
henri matisse green line essay
laboratory skills to put on resume
回复 支持 反对

使用道具

该用户从未签到

0

主题

185

帖子

500

积分

高级会员

Rank: 4

积分
500
发表于 2019-11-1 05:29:07 | 显示全部楼层

only for you is in canada

wЖааИЙМЗb ·±нУЪ 2018-8-23 09:30
**** ЧчХЯ±ыЦ№тЙэ ДЪИЭЧФЖБ±О ****

how com is cost so much
回复 支持 反对

使用道具 举报

匿名  发表于 2019-11-1 06:27:58

drug abuse solutions essay


Darien Cox from Lake Forest was looking for drug abuse solutions essay

Julian Stone found the answer to a search query drug abuse solutions essay




drug abuse solutions essay






























dissertation chapter editing service ca
educator resume service
custom report proofreading sites uk
dissertation dubai tourism
definition essay literary
dancing academy business plan
education outreach resume
educational data mining+phd thesis+pdf
custom phd creative essay examples
cv template resume
cv cover letter templates microsoft
differences between written report and research proposal
definition essay writer sites ca
drunk driving essays persuasive speech
design specification textiles coursework
esl dissertation introduction editor for hire for phd
entry level consulting resume examples
esl thesis writer services for masters
democratic republic congo essays
economic analysis a research paper series
custom movie review ghostwriter sites for college
esl content ghostwriter sites online
easy homework
esl dissertation chapter ghostwriters services au
esl analysis essay ghostwriter for hire ca
custom book review ghostwriter websites usa
do you put cover letter on resume paper
do my cheap college essay on presidential elections
devising business plan
entry level financial planning cover letter
esl dissertation proposal writer service gb
division essays examples
custom content writing website for masters
esl dissertation writers service for university
eight legged essay
esl masters essay writing website online
custom scholarship essay ghostwriters services for phd
custom homework ghostwriters sites for masters
custom rhetorical analysis essay writers website gb
cv editor services
email title for resume
esl college essay writer sites uk
diet pills essay
回复 支持 反对

使用道具

匿名  发表于 2019-11-1 07:26:40

north eastern essay topics

УОН 178.137.164.x ·±нУЪ 2019-11-1 05:18
Jameson Thomas from Athens-Clarke County was looking for tips to write essay in english

Shaqu ...

Austyn Warren from Portland was looking for north eastern essay topics

Hugh Hart found the answer to a search query north eastern essay topics




north eastern essay topics






























owner resume examples
pay to do earth science case study
popular best essay writing services
order zoology book review
masters proofreading for hire ca
marketing and management resume
modele business plan restaurant rapide
learning community expository essay contextual issues in professional development
pay to do esl dissertation
pay for custom university essay
popular bibliography ghostwriting sites for university
literary analysis of stopping by woods on a snowy evening
living murray business plan 2007
popular academic essay ghostwriter website us
model question paper for ibps po mains
pay to write professional descriptive essay on civil war
nurse summary resume
methodologie de la dissertation de philo
masters dissertation types
patriotic essay scholarships
pay to get technology dissertation introduction
outside sale resume sample
marshall mcluhan television essay
papers writing for hire
literary analysis of the book thief
popular creative writing writer service gb
manmohan singh resume
ocr physics b materials coursework
make money writing online
pay for my best definition essay on shakespeare
mla outline with thesis
mba admission essay editing
pay to write top rhetorical analysis essay on brexit
popular academic essay ghostwriting services for school
letter proofreading sites uk
objective on a resume for a customer service job
outreach resume sample
oroonoko essay questions
online grocery business plan
opera thesis
mla handbook for writers of research papers by joseph gibaldi
oberlin supplement essay example
major sections of research paper
persuasive essays pros and cons
meaning of shooting an elephant essay
literature review on balanced literacy
personal narrative topics for grade 6
回复 支持 反对

使用道具

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

QQ|Archiver|手机版|妙想源码社区 积分提现

GMT+8, 2019-11-21 08:40 , Processed in 1.136401 second(s), 27 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2020 Comsenz Inc.

快速回复 返回顶部 返回列表
 
FDGDF
客服QQ 妙想科技 244594752
【旺旺】 点击这里给我发消息
【邮箱】
244594752@qq.com
【地址】 湖南省常德市武陵区三姑巷77
【妙想科技】 【9188qhl.com】