1.easyui tree refresh 问题
2.如何获取jquery easyui Tree的源码 (1)某一节点下的所有子节点,(2)某节点下的源码奇迹2源码一级节点
3.easyui treeè·åç¶èç¹çç¶èç¹
4.easyuiçtreeå¦ä½èªå¨è§¦åä¸ä¸ªclickäºä»¶
easyui tree refresh 问题
假设你的tree定义的时候的url是"urlA",在onBeforeExpand的源码mdpi期刊源码时候是"urlB",那么reload这个tree的源码form源码下载代码是这样的:function treeReload(){$("#tt").tree("options").url="urlA";
$("#tt").tree("reload");
}
举例:
假如自定义的tree是这样的:
<ul id="tt" class="easyui-tree" data-options="
url:"urlA",
onBeforeExpand:function(node){
$('#tt').tree('options').url="urlB"; //展开时发送请求去加载节点
}"></ul>
那么调用treeReload()方法就可以刷新这个tree了。其实就是源码openstack 源码获取把tree的加载子节点的url给赋值成根节点的url,然后reload。源码android talkback 源码
如何获取jquery easyui Tree的源码 (1)某一节点下的所有子节点,(2)某节点下的源码一级节点
//某一节点下的所有子节点
function getChildren(id/*节点ID*/){
var $tree = $('#tree');
var node = $tree.tree('find',id);
var childrenNodes = $tree.tree('getChildren',node.target);
return childrenNodes;
}
//某节点的一级节点
function getSubChildren(id){
var $tree = $('#tree');
var node = $tree.tree('find',id);
var subNodes = [];
$(node.target)
.next().children().children("div.tree-node").each(function(){
subNodes.push($tree.tree('getNode',this));
});
return subNodes;
}
easyui treeè·åç¶èç¹çç¶èç¹
å¯ä»¥åè以ä¸ä»£ç ï¼ <pre name="code" class="html"><td style="height: px" colspan="7">
<input id="fm_AEType" class="easyui-combotree" style="width: px" />
<label id="fm_AETypePath" />
</td></pre>
JavaScript页é¢ï¼å æ¬æ°æ®åå§åï¼ï¼
initAEType: function ()
{
$.ajax(
{
url: AEActionUrl + '?action=listaetype&ParentType=',dataType: 'json',success: function (jsonstr)
{
$('#fm_AEType').combotree(
{
data: jsonstr, editable: false,//lines: true, valueField: 'AE_TYPE_ID',textField: 'AE_TYPE_NAME'ï¼onLoadSuccess: function ()
{
$('#fm_AEType').combotree('tree').tree("collapseAll");
}
onSelect: function (item)
{
var parent = item;
var tree = $('#fm_AEType').combotree('tree');
var path = new Array();
do
{
path.unshift(parent.text);
var parent = tree.tree('getParent', parent.target);
}
while (parent);
var pathStr = '';
for (var i = 0; i < path.length; i++)
{ pathStr += path[i];
if (i < path.length - 1)
{ pathStr += ' - '; }
}
$('#fm_AETypePath').text(pathStr);
}
});
}
});
}
å½åå»æé®æ¶è§¦åäºä»¶ï¼å¨è¿ä¸ªäºä»¶ä¸å¯ä»¥è·å¾srcElementä¹å°±æ¯äºä»¶èç¹ã
éè¿è¿ä¸ªäºä»¶èç¹ï¼æ们å¯ä»¥ä½¿ç¨æ åä¸parentNodeå±æ§ï¼å¼è·å¾å ¶ç¶èç¹å ç´ ï¼ä¸ç´éè¿è¿ä¸ªå±æ§æ¾å°type为ULçèç¹ï¼ä¹å°±æ¯ææliçç¶èç¹å ç´ ã
éè¿ULçchildNodeså±æ§ï¼è·å¾ææçliåèç¹ï¼ç¶ååå¨liä¸å¤çå ¶åèç¹çç¸å ³å±æ§ï¼å°±å¯ä»¥è¾¾å°ä½ æ说çç®çäºã
easyuiçtreeå¦ä½èªå¨è§¦åä¸ä¸ªclickäºä»¶
onclickä¸æ¯å¨çå¬åï¼æå¦ä½æ¨¡æä¸æ¬¡åãè¿æ¯ä¸æï¼è½å¦ç®ååä¸ä»£ç ãã[mw_shl_code=javascript,true]$('#tt').tree({ onClick: treeClik, onLoadSuccess: function(node){ var node = $('#tt').tree('find', ); $('#tt').tree('select', node.target); treeClik(treeClik); //è¿éè½ä¸è½ç»å®ä¸ä¸ªç±»ä¼¼jqueryçtriggeräºä»¶ï¼è¿å ¥é¡µé¢æ¶èªå¨åå»è¿ä¸ªèç¹ï¼äº§çalertææ },});function treeClik(node){ }[/mw_shl_code]