No diré muchas tonterías, solo te postularé el código.
El código específico es el siguiente:
1. Front End
<%@ page lenguaje = "java" pageEncoding = "utf-8" contentType = "text/html; charset = utf-8"%> <script type = "text/javaScript"> $ (function () {$ ('#books_type_treegrid'). Treegrid ({url: '$ {pageContext.request.contextpath} /admin/goodstypecontroller/treegrid.do?id=null',idfield:' id ', treefield:' text ', rewnowmers: true, trueyfield:' pid ', fit: true, fitcolumns: true, fronter: false, frzencolumns: [{titular:', fit: ',', ',', ',', ',', fallas: 'Number:' '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 : 50},{field : 'code',title : 'category encoding',width : 50}, {campo: 'pid', título: 'ID de categoría superior', ancho: 150, Hidden: true}, {campo: 'Action', Title: 'Action', Width: 50, Formatter: function (valor, fila, index) {return FormatString ('<img onClick = "Goods_type_editfun (/' {0}/');" src = "{1}"/>> ', fila.id,' $ {pageContext.request.contextPath} /style/images/extjs_icons/pencil.png ', fila.id,' $ {pageContext.request.contextpath} /style/images/icons/cancel.png '}}}}}}] ], Barra de herramientas: [{text: 'lote import', icOncls: 'icon-remove', handler: function () {Goods_type_importfun ();}}, {text: 'add', icOncls: 'icon-add', handler: function () 'Expandir', icOnCls: 'icon-redo', handler: function () {var node = $ ('#betss_type_treegrid'). TreeGrid ('getSelected'); if (node) {$ ('#books_type_treegrid'). Treegrid ('expandall', node.cid);} {$ ('#Goods_type_Treegrid'). TreeGrid ('expandall');}}}, '-', {text: 'fold', icOnCls: 'icon-undo', handler: function () {var nodo = $ ('#bets_type_treegrid'). Treegrid ('getSelected'); if (node) {$ ('#Goods_type_treegrid'). TreeGrid ('colapseSeall', node.cid);} else {$ ('#betss_type_treegrid'). TreeGrid ('colapseall');}}}, '-', {texto: 'refresh', iConcls: 'Icon-Reload', Handler () {$ ('#Goods_Type_treegrid'). TreeGrid ('reload');}}], onbeforeExpand: function (row) {// Configuración dinámica de url var url para expandir la consulta var url = '$ {pageContext.request.contextPath} /admin/goodstypecontroller/treegriDoGridEgriDoGriDoReGriDoReGrid.DoReGriDoReGrid.DoReGriDoReGrid.DoReGriDoReGriDoReGriDoReGriDoReGriT $ ("#Goods_Type_Treegrid"). TreeGrid ("Opciones"). Url = Url; Row.id); $ ('#Goods_Type_Menu'). Menu ('show', {izquierda: e.pagex, top: e.pagey});}, onexpand: function (fila) {var children = $ ("#Goods_type_Treegrid"). TreeGrid ('getChildren', row.id); if (children.length <= 0) {row.leaf = true; $ ("#bets_type_treegrid"). Treegrid ('refresh', row.id);}}});}); </script> <stable id = "Goods_type_treegrid"> </table>2. Controlador
@RequestMapping ("/TreeGrid")@ResponseBodyPublic List <GoodStypePage> TreeGrid (GoodStypePage GoodSpepage) {if (null == GoodStypePage || "" .equals (GoodSpEpage.getIDId ()) || GoodSpeservice.treegrid (GoodStypePage);}3. Servicio
@Anulación // Cache Data Public List <OWNSTYPEPAGE> TreeGrid (GoodSpepage GoodSpage) {String hql = ""; if (null == GoodStypePage || "" .equals (GoodSpepage.getId ()) || "NULL" .Equals (GoodStypePage.getId ())) {HQL = "de GoodStype thite t de WhereStToodStytyStyStyStyStyStyStyStyStyStyStyStyStyStyStyStyStyStyStyStySTOYT Orden nulo de t.seq ";} else {hql =" de GoodStype t donde t.tgoodstype.id = '" +goodSpepage.getId () +"' Order by t.seq ";} list <Goodstype> brllist = goodSpedAo.find (hql); listypepage> if (brlisty ! = null && brllist.size ()> 0) {for (GoodStype Br: Brlist) {GoodSpepage r = new GoodSpepage (); Beanutils.CopyProperties (Br, r); if (br.gettGoodType ()! = null) {r.setpName (br.gettGoodType (). getText ()); r.setpid (br.gettgoodType (). getId ());} r.setState ("cerrado"); nl.add (r);}} return nl;}