EasyUI Forum
May 15, 2024, 09:45:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: access combotree function on datagrid editor  (Read 4948 times)
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« on: April 02, 2015, 12:54:52 AM »

i've trie this methods for tree :

Code:
$.extend($.fn.tree.defaults.methods, {
highlight: function(jq, target){
return jq.each(function(){
$(this).find('.tree-node-selected').removeClass('tree-node-selected');  /*isoft; original: .tree.node.hover*/
$(target).addClass('tree-node-selected');
})
},
navTree: function(jq){
return jq.each(function(){
var t = $(this);
t.attr('tabindex',0);
t.unbind('.tree').bind('keydown.tree', function(e){
var curr = getCurr();
if (!curr.length){return}
if (e.keyCode == 40){ // down
var li = getNext(curr);
if (li.length){
t.tree('highlight', li[0]);
t.tree('scrollTo',li[0]);  /*isoft*/
}
} else if (e.keyCode == 38){ // up
var li = getPrev(curr);
if (li.length){
t.tree('highlight', li[0]);
t.tree('scrollTo',li[0]); /*isoft*/
}
} else if (e.keyCode == 13){
t.tree('select', curr[0]);
} else if (e.keyCode == 39){ // right
if (!t.tree('isLeaf', curr[0])){
t.tree('expand', curr[0]);
}
} else if (e.keyCode == 37){ // left
if (!t.tree('isLeaf', curr[0])){
t.tree('collapse', curr[0]);
}
}
e.preventDefault();
}).bind('mouseover.tree', function(e){
var node = $(e.target).closest('div.tree-node');
if (node.length){
t.find('.tree-node-hover').each(function(){
if (this != node[0]){
$(this).removeClass('tree-node-hover');
}
})
}
});
function getCurr(){
var n = t.find('.tree-node-hover');
if (!n.length){
n = t.find('.tree-node-selected');
}
return n;
}
function getNext(curr){
var n = $();
var node = t.tree('getNode', curr[0]);
if (t.tree('isLeaf', node.target)){
n = curr.parent().next().children('div.tree-node');
if (!n.length){
var p = t.tree('getParent', curr[0]);
if (p){
n = $(p.target).parent().next().children('div.tree-node');
}
}
} else {
if (node.state == 'closed'){
n = curr.parent().next().children('div.tree-node');
} else {
var cc = t.tree('getChildren', curr[0]);
if (cc.length){
n = $(cc[0].target);
}
}

}
return n;
}
function getPrev(curr){
var n = curr.parent().prev().children('div.tree-node');
if (n.length){
var node = t.tree('getNode', n[0]);
if (node.state == 'open'){
var cc = t.tree('getChildren', node.target);
if (cc.length){
n = $(cc[cc.length-1].target);
}
}
} else {
var p = t.tree('getParent', curr[0]);
if (p){
n = $(p.target);
}
}
return n;
}
})
}
});

now, i place combotree on my datagrid as editor, how to access above method for my cobotree's tree?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!