javaBean类:
import java.util.List;public class EasyuiTreeObject {private String id;private String text;private String state;private String busi;private List<EasyuiTreeObject> children;private String domId;private String checkState;private boolean _checked;private boolean checked;private String target;private String pid;private String isLeaf;private String remark;public String getPid() {return pid;}public void setPid(String pid) {this.pid = pid;}public String getId() {return id;}public void setId(String id) {this.id = id;}public String getText() {return text;}public void setText(String text) {this.text = text;}public String getState() {return state;}public void setState(String state) {this.state = state;}public List<EasyuiTreeObject> getChildren() {return children;}public void setChildren(List<EasyuiTreeObject> children) {this.children = children;}public String getBusi() {return busi;}public void setBusi(String busi) {this.busi = busi;}public String getDomId() {return domId;}public void setDomId(String domId) {this.domId = domId;}public String getCheckState() {return checkState;}public void setCheckState(String checkState) {this.checkState = checkState;}public boolean is_checked() {return _checked;}public void set_checked(boolean _checked) {this._checked = _checked;}public boolean isChecked() {return checked;}public void setChecked(boolean checked) {this.checked = checked;}public String getTarget() {return target;}public void setTarget(String target) {this.target = target;}public String getIsLeaf() {return isLeaf;}public void setIsLeaf(String isLeaf) {this.isLeaf = isLeaf;}public String getRemark() {return remark;}public void setRemark(String remark) {this.remark = remark;}}
Controller类:
@RequestMapping(value = \"tree/asyn/load\")@ResponseBodypublic Object asynLoadData(Model model,ServletRequest request){Map<String, String> sessionUserInfo = (Map) WebUtils.getSessionAttribute((HttpServletRequest) request,Constant.SESSION_USER_MAP);List<EasyuiTreeObject> tree=Lists.newArrayList();String id = request.getParameter(\"id\");Map<String,Object> parameters = Maps.newHashMap();parameters.put(\"id\", id);parameters.put(\"yxbj\", \"1\");BnYljgFwjzw fwjzw = bnYljgFwjzwServiceProvider.findUniqueBy(parameters);String zcsStr = fwjzw.getFwjzcs();if(StringUtils.isNotBlank(zcsStr)) {int zcs = Integer.valueOf(zcsStr);for (int i = 1; i <= zcs; i++) {EasyuiTreeObject treeObj = new EasyuiTreeObject();treeObj.setId(i+\"\");treeObj.setText(i+\"\");treeObj.setState(\"open\");treeObj.setChildren(null);tree.add(treeObj);}}return tree;}
Easyui-jQuery:
<script type=\"text/javascript\">$(function(){$(\'#inp\').combotree({valueField: \"id\", //Value字段textField: \"text\", //Text字段multiple: true,url:urltree});}</script><input class=\"form-control easyui-combotree\" name=\"inp\" id=\"inp\" data-options=\"prompt:\'样式\',panelWidth:300,panelHeight:300\" style=\"width:100%;height:32px\" value=\"\">