私はそれほどナンセンスとは言いません、私はあなたにコードを投稿するだけです。
特定のコードは次のとおりです。
1。フロントエンド
<%@ page Language = "Java" PageEncoding = "utf-8" contentType = "text/html; charset = utf-8"%> <script = "text/javascript"> $(function(){$( '#good goods_type_treegrid')。 '$ {pagecontext.request.contextpath}/admin/goodstypecontroller/treegrid.do? id = null',Idfield:' id '、treefield:' text '、rownumbers:true、parentfield:' pid '、fit:true、fitcolumns:true、fals、fals、flozencolumns: 'id'、width:150、hidden:true}、{field: 'text'、title: 'category name'、width:200}]、columns:[{field: 'pname'、title: 'superior category name'、width:80}、{field: 'seq'、title: 'sorting'、width: 'cattitle:' wid: 'field:' field: 'field:' field: 'field:' field: 'field:' field: 'field:'カテゴリ: 50}、{field: 'pid'、title: 'superior category id'、width:150、hidden:true}、{field: 'action'、title: 'action'、width:50、formatter:function(value、row、index){return formattring( '<img onclick = "soods_type_editfun(/' {0}/'); src = "{1}"/>> '、row.id、' $ {pagecontext.request.contextpath} /style/images/extjs_icons/pencil.png '、row.id、' $ {pagecontext.request.request.contextpath} ]、ツールバー:[{{text: 'batch Import'、iconcls: 'icon-remove'、handler:function(){goods_type_importfun();}、{text: 'add'、iconcls: 'icon-add'、handler:function(){good_ty_pe_appenfun(); 'Expand'、Iconcls: 'Icon-redo'、handler:function(){var node = $( '#good_type_treegrid')。treegrid( 'getSelected'); if(node); if(node){$( '#goods_type_treegrid')。 {$( '#good_type_treegrid')。treegrid( 'enductall');}}、 ' - '、{text: 'fold'、iconcls: 'icon-undo'、handler:function(){var node = $( '#good goods_type_treegrid')。 {$( '#good_type_treegrid')。treegrid( 'collapseall'、node.cid);} else {$( '#good_type_treegrid')。 {$( '#Goods_type_treegrid')。treegrid( 'reload');}}]、onbeforeexpand:function(row){//クエリvar url = '$ {pagecontext.request.Request.Request.Request.Request.Request.Request.ContextPath} $( "#goods_type_treegrid")。treegrid( "options")。url = url; row.id); $( '#good _type_menu') $( "#goods_type_treegrid") id = "goods_type_treegrid"> </table>2。コントローラー
@RequestMapping( "/treegrid")@ResponseBodyPublic List <GoodStypePage> treeGrid(goodStypepage goodStypepage){if(null == goodstypepage || "" .equals(goodstypepage.getid()|| null == goodstepepage.getid() goodstypeService.treegrid(goodstypepage);}3。サービス
@Override // Cache Data Public List <GoodStypePage> TreeGrid(GoodStypePage goodStypepage){string hql = ""; if(null == goodstypepage || "" .equals.getId()|| "null" .efAls(goodStypepage.getid()){hql = " t.tgoodstype.idはt.seq ";} else {hql =" by goodstype tからnull orderです。 ArrayList <GoodStypePage>(); if(brlist!= null && brlist.size()> 0){for(goodstype br:brlist){goodstypepage r = new goodstypepage(); beanutils.copyproperties(br、 r); if(br.gettgoodtype()!= null){r.setpname(br.gettgoodtype()。getText()); r.setpid(br.gettgoodtype()。