Ich werde nicht viel Unsinn sagen, ich werde Ihnen nur die Code posten.
Der spezifische Code lautet wie folgt:
1. Frontend
<%@ page Language = "java" pageCoding = "utf-8" contentType = "text/html; charset = utf-8"%> <script type = "text/javascript"> $ (function () {$ ('#Goods_type_TreeGrid'). TreeGrid ({{Url: {Url: '${pageContext.request.contextPath}/admin/goodsTypeController/treegrid.do?id=NULL',idField: 'id',treeField: 'text',rownumbers: true,parentField: 'pid',fit : true,fitColumns : true,border : false,frozenColumns : [ [ {title : 'number',field : '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}, {Field: 'PID', Titel: 'Superior Category ID', Width: 150, Hidden: True}, {Feld: 'Action', Titel: 'Action', Width: 50, Formatter: Funktion (Wert, Zeile, Index) {return formatstring ('<img onclick = "Goodes_type_editfun (/' {0}/'; src = "{1}"/>> ', row.id,' $ {pageContext.request.contextPath} /style/images/extjs_icons/pencil.png ', row.id.id, '$ {pageContext.request.contextPath} /style/images/extjs_icons/cancel.png');}}], Symbolleiste: [{text: 'batchimporte', iconcls: 'icon-remove', Handler: Funktion () {{vosen_type_importfun (), {) {{{{{{vol. 'Add', iconcls: 'icon-add', Handler: function () {goods_type_appendfun ();}}, '-', {text: 'expt', iconcls: 'icon-redo', Handler: function () {var node = $ ('#Goodes_tree_tree_TeGrid'). oder $ ('#goods_type_treegrid'). Treegrid ('getSelected'); if (node) {$ ('#goods_type_treegrid'). Treegrid ('collapeAll', node.cid);} else {$ ('#Goods_type_treegrid'. : 'refresh', iconcls: 'icon-reload', Handler: function () {$ ('#goods_type_treegrid'). Treegrid ('reload');}}], onbeforexpand: function (row) {// dynamische Einstellung von URL-VAR-VAR-VAR-VAR-VAR-VAR-VAR-VAR-VARR. $ {PageContext.Request.ContextPath} /admin/goodstypecontroller/treegrid.do '; {e.preventDefault (); $ (this) .Treegrid ('unSelektall'); $ (this) .Treegrid ('select', row.id); $ ("#Goods_type_treegrid"). Treegrid ('getChildren', row.id); if (children.length <= 0) {row.leaf = true; $ ("#goods_type_treegrid"). Treegrid ('refresh', row.id);}});}); id = "Goods_type_treegrid"> </table>2. Controller
@RequestMapping("/treegrid")@ResponseBodypublic List<GoodsTypePage> treegrid(GoodsTypePage goodsTypePage) {if(null==goodsTypePage || "".equals(goodsTypePage.getId()) || null == goodsTypePage.getId()){goodsTypePage.setId("NULL");} return GoodstypeService.Treegrid (GoodstypePage);}3. Service
@Override // cache data publiclist <GoodstypePage> Treegrid (GoodStypePage GoodstypePage) {String hql = ""; if (null == GoodstypePage || "" .Equals (Goodstypepage.getId ()) "Null" .equals (Goodstypepage.GetId ()) {HQL = {HQL = {HQL = Null Order von T.Seq ";} else {hql =" von Goodstype t won t.tgoodstype.id = '" +goodStypepage.getId () +"' Order von T.Seq "; null && brlist.size ()> 0) {für (Goodstype Br: Brlist) {GoodstypePage r = new GoodstypePage (); beanutils.copyProperties (BR,, r); if (br.gettgoodtype ()!