Saya tidak akan mengatakan banyak omong kosong, saya hanya akan memposting kode kepada Anda.
Kode spesifiknya adalah sebagai berikut:
1. Ujung depan
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><script type="text/javascript">$(function() {$('#goods_type_treegrid').treegrid({url: '$ {pageContext.Request.contextPath} /admin/goodstypecontroller/treegrid.do?id=null',idfield:' id ', Treefield:' Text ', Field: Foelfield:' PID ', Fit: True, FitColumns: True, Border: FORE: FROLDFIELD:' PID ', Fit: True, FitColumns: True, Border: FORTE: FROSFIELD: FROLFIELD: PID', Fit: True, FitColumns: True, FORTE: FALSE: FROSFIELD: 'PID', [true, fitcolumns: true, border: false: foose: fro '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', judul: 'ID kategori superior', lebar: 150, tersembunyi: true}, {field: 'action', title: 'action', width: 50, formatter: function (value, row, index) {return formatstring ('<img ontclick = "goods_type_editfunfunfunfunfunfunfunfunfunfunfunfunfunfunfunfun (/' src = "{1}"/>> ', row.id,' $ {pagecontext.request.contextPath} /style/images/extjs_icons/pencil.png ', row.id, '$ {pageContext.Request.contextPath} /style/images/extjs_icons/cancel.png');}}]], toolbar: [{{text: 'BOCK_TYPE_COPPORT:' ICON-REMOVE ', Handler: function () {goods', oCType_corpor (ICon-remove ', handler: function () {goods', {{{{{{{) {{{{{{{) {{{{{{{) {{{{{{), ; {$ ('#goods_type_treegrid'). TreeGrid ('Expandall', node.cid);} else {$ ('#goods_type_treegrid'). TreeGrid ('Expandall');}}}, '-', {text: 'lipt', iconcls: 'icon-icon-icon-loDo) $ ('#goods_type_treegrid'). TreeGrid ('getSelected'); if (node) {$ ('#goods_type_treegrid'). TreeGrid ('collapseall', node.cid);} else {$ ('#goods_type_treegrid'). TreeGrid ('{' $ ('#goods_type_treegrid'). TREEGRIGE ('{' $ ('#goods_type_treeGrid'). TREEGRID ('{' $ ('#goods_type_treeGrid'). 'Refresh', iconCls: 'Icon-Reload', Handler: function () {$ ('#goods_type_treegrid'). TreeGrid ('Reload');}}], OnbeforeExpand: Function (ROW) {// Pengaturan Dinamis URL var Url untuk memperpanjang query var url = '$ {pagecontext.Request.contextPath} /admin/goodstypecontroller/treegrid.do'; {e.preventDefault (); $ (this) .treegrid ('unselectall'); $ (this) .treegrid ('select', row.id); $ ('#goods_type_menu'). menu ('show', {left: e.pagex, top: e.page});}, satu -satunya $ ("#goods_type_treegrid"). TreeGrid ('getchildren', row.id); if (anak -anak2. Pengontrol
@RequestMapping ("/TreeGrid")@ResponseBodyPublic Daftar <GoodstypePage> TreeGrid (GoodstypePage GoodstypePage) {if (null == Goodstypepage || "" .Sequals (goodstypepage.getId ()) || null == goodstypePage.getid () {goodstypage.getId () || null == goodstypepage.getid () {goodsetid (goodset () || null == goodstypePage.getid () {goodsety () {goodset () goodstypeservice.treegrid (goodstypepage);}3. Layanan
@Override // Data cache DAFTAR PUBLIK <GOODSTYPEPAGE> TREEGRID (GOODSTYPEPAGE GOODSTYPEPAGE) {string hql = ""; if (null == goodstypePage || "" .Equals (goodstypepage.getid ()) || "null" .Equals (goodstypePage.getid ()) {null ". NULL order by t.seq";}else{hql = "from GoodsType t where t.tgoodstype.id = '" +goodsTypePage.getId()+"' order by t.seq";}List<GoodsType> brList = goodsTypeDao.find(hql);List<GoodsTypePage> nl = new ArrayList<GoodsTypePage>();if (brList ! = null && brlist.size ()> 0) {for (goodstype br: brlist) {goodstypepage r = goodstypepage baru (); beanutils.copyproperties (BR, r); if (br.gettgoodType ()! = null) {r.setpname (br.gettgoodType (). getText ()); r.setpid (br.gettgoodType (). getid ());} r.setState ("tertutup"); nl.add (r);}}}}}}}}}}}}}}}};