做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

ajax請求后臺得到json數據后動態生成樹形下拉框的方法

來源:懂視網 責編:小采 時間:2020-11-27 22:51:30
文檔

ajax請求后臺得到json數據后動態生成樹形下拉框的方法

ajax請求后臺得到json數據后動態生成樹形下拉框的方法:如下所示: <select id=cc class=easyui-combotree style=width:580px; name=rempId data-options=required:true></select> <script> $(function(){ $.ajax({ url
推薦度:
導讀ajax請求后臺得到json數據后動態生成樹形下拉框的方法:如下所示: <select id=cc class=easyui-combotree style=width:580px; name=rempId data-options=required:true></select> <script> $(function(){ $.ajax({ url

如下所示:

<select id="cc" class="easyui-combotree" style="width:580px;" name="rempId" data-options="required:true"></select>

<script>

$(function(){
$.ajax({
url:"departmentAction_getAllDep.action",
type:"post",
success:function(result){
//console.log(result);
$("#cc").combotree('loadData',b1(result));
}
});
$("#cc").combotree({
animate:true,
//選擇樹節點觸發事件 
 onSelect : function(node) { 
 n = node;
 //返回樹對象 
 var tree = $(this).tree; 
 //選中的節點是否為葉子節點,如果不是葉子節點,清除選中 
 var isLeaf = tree('isLeaf', node.target); 
 if (!isLeaf) { 
 //清除選中 
 $("#cc").combotree('clear'); 
 } 
 } 
});
});

var tree = {
id:'', 
 text:'', 
 state:'', 
 checked:'', 
 iconCls:'',
 attributes:'', 
 children:''
}

function b1(result){
var t = [];
$.each(result,function(index,dept){
t[index] = b2(dept);
});
return t;
}

function b2(dept){
 var tree = new Object();
tree.id = dept.depId; 
 tree.text = dept.depName; 
 tree.state = 'closed'; 
 tree.checked = 'false';
 if(dept.employees.length != 0){
 tree.children = b3(dept.employees);
 }else{
 tree.children = [];
 }
 return tree;
}

function b3(employees){ 
 var easyTree = []; 
 $.each(employees,function(index,item){ 
 easyTree[index] = b4(item); 
 }); 
 return easyTree; 
} 
 
function b4(item){
var tree = new Object();
tree.id = item.empId;
tree.text = item.empName;
if(item.empSex == "男"){
tree.iconCls = 'icon-nan';
}else{
tree.iconCls = 'icon-female';
}
return tree;
} 

</script>

department表中的dept_id作為employee表中有的外鍵,生成的Department.java類中有Set<employee>對象。從后臺查詢部門表,得到List<Department>集合,通過struts2配置:

<action name="departmentAction_*" class="com.chinasoft.action.DepartmentAction" method="{1}">
<result name="getAllDep" type="json">
<param name="root">list</param>
</result>
</action>

轉成json格式后,傳到jsp頁面,在前臺頁面中處理json數據,動態生成下拉樹。

以上這篇ajax請求后臺得到json數據后動態生成樹形下拉框的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

ajax請求后臺得到json數據后動態生成樹形下拉框的方法

ajax請求后臺得到json數據后動態生成樹形下拉框的方法:如下所示: <select id=cc class=easyui-combotree style=width:580px; name=rempId data-options=required:true></select> <script> $(function(){ $.ajax({ url
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 武宣县| 佛山市| 海口市| 赞皇县| 喀喇| 永新县| 儋州市| 水城县| 大厂| 浮山县| 绍兴市| 邵武市| 璧山县| 武冈市| 封丘县| 溆浦县| 蓝山县| 滦平县| 隆安县| 泾源县| 横峰县| 满洲里市| 临沭县| 万年县| 彰化县| 保亭| 温州市| 榆树市| 大厂| 广丰县| 周宁县| 鹿泉市| 临潭县| 新宁县| 镇宁| 于都县| 和林格尔县| 新乡市| 尖扎县| 兴安县| 晋中市|