自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

EasyUI ComboTree

開發(fā) 開發(fā)工具
設(shè)置欄目樹選中無效,在用戶點(diǎn)擊勾選復(fù)選框之前觸發(fā),返回false可以取消選擇動(dòng)作。

 

  1. <div class="easyui-dialog" id="user_dialog_role" title="選擇用戶功能權(quán)限" style="background-color:#fcfcfc;width:20%;height:85%;" 
  2.  data-options="closed:true,modal:true
  3.  buttons:[{ 
  4.  text:'選 擇'
  5.  handler:function(){ 
  6.  getChecked(); 
  7.  $('#user_dialog_role').dialog('close'); 
  8.  } 
  9.  }]"> 
  10.  <form id="user_form_role" name="user_form_role" method="post"
  11.  <div class="easyui-panel" fit="false" border="false"
  12.  <ul id="user_tree_role" checkbox="true" cascadeCheck="false" 
  13.  style="background-color:#fafafa;"></ul> 
  14.  <input type="hidden" id="tree_type"
  15.  </div> 
  16.  </form> 
  17. </div> 
  1. function userRole(type){ 
  2.  $('#user_tree_role').tree({ 
  3.  url: '${request.contextPath}/menu/tree'
  4.  onLoadSuccess: function (e, node) { 
  5.  treeChecked(node, type); 
  6.  }, 
  7.  onBeforeCheck: function (e, checked) {//設(shè)置欄目樹選中無效,在用戶點(diǎn)擊勾選復(fù)選框之前觸發(fā),返回false可以取消選擇動(dòng)作 
  8.  /* if (type == 'new') { 
  9.  if (e.attributes.virtualColumn == 'true') { 
  10.  return false
  11.  } 
  12.  } else { 
  13.  if (e.attributes.virtualColumn == 'true' || e.id == $('#column_tree').tree('getSelected').id) { 
  14.  return false
  15.  } 
  16.  } */ 
  17.  } 
  18.  }); 
  19.  $('#tree_type').val(type); 
  20.  $('#user_dialog_role').dialog('open'); 
  1. function treeChecked(node, type) {//遍歷節(jié)點(diǎn),符合要求的更新對(duì)應(yīng)節(jié)點(diǎn) 
  2.  var menuVal = ''
  3.  if (type == 'add') { 
  4.  menuVal = $('#menuID').val() + ","
  5.  } else { 
  6.  menuVal = $('#menuID_edit').val() + ","
  7.  } 
  8.  $.each(node, function (idx, val) { 
  9.  if (val instanceof Object) { 
  10.  var nodes = $('#user_tree_role').tree('find', val.id); 
  11.  if (nodes != null) { 
  12.  if (menuVal.indexOf(val.id + ",") != -1) {//選中已勾選的欄目 
  13.  $('#user_tree_role').tree('update', {target: nodes.target, checked: true}); 
  14.  } 
  15.  } 
  16.  } 
  17.  if (val.children) { 
  18.  treeChecked(val.children, type);//如果還有子節(jié)點(diǎn)則繼續(xù)遍歷 
  19.  } 
  20.  }); 
  21. function getChecked() { 
  22.  var nodes = $('#user_tree_role').tree('getChecked'); 
  23.  var s = ''
  24.  var v = ''
  25.  for (var i = 0; i < nodes.length; i++) { 
  26.  if (s != '') s += ','
  27.  s += nodes[i].text; 
  28.  if (v != '') v += ','
  29.  v += nodes[i].id; 
  30.  } 
  31.  var t=$('#tree_type').val(); 
  32.  if(t=='add'){ 
  33.  $('#menuID').val(v); 
  34.  $('#menu').textbox('setValue', s); 
  35.  } 
  36.  if(t=='edit'){ 
  37.  $('#menuID_edit').val(v); 
  38.  $('#menu_edit').textbox('setValue', s); 
  39.  } 

【本文是51CTO專欄作者張勇波的原創(chuàng)文章,轉(zhuǎn)載請(qǐng)通過51CTO獲取作者授權(quán)】

責(zé)任編輯:武曉燕 來源: 上下求索的Z先生博客
相關(guān)推薦

2012-07-10 09:34:50

jQuery

2016-12-15 09:17:30

easyui form數(shù)據(jù)方法

2016-12-13 13:38:50

easyuiopen上傳框

2011-07-25 14:49:36

jQuery

2016-12-13 13:54:10

EasyUI form數(shù)據(jù)加載

2015-06-25 15:39:17

WebWeb應(yīng)用程序

2015-12-09 09:03:22

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)