/**
 * 树型获取同一级的所有节点重新排序
 * id tree的id
 * targetNode DOM 对象,这个节点是被放置的目标
 * return 数组
 */
function TreeLevelNodeOrder(id,targetNode){
	var parent = $('#'+id).tree('getParent', targetNode);
	//获取同一级节点
	var nodeList = parent?$('#'+id).tree('getChildren',parent.target):$('#'+id).tree('getRoots');
	var orders = new Array();
	$.each(nodeList,function(i,val){
		orders[i] = nodeList[i].id;
	});
	return orders;
}

HTML

<div class="table_search" id="search_box">
    <div class="br">
        <div class="item">XXX:<input type="text" id="no"/></div>
        <div class="item">XXX:<input type="text" id="realname" com="combotree"/></div>
        <div class="item">
            XXX:<select id="is_order" class="easyui-combobox" style="width:50px" com="combobox">
                    <option value="">全部</option>
                    <option value="1">是</option>
                    <option value="0">否</option>
                </select>
        </div>
        <div class="clear"></div>
    </div>
</div>
<a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" id="search_submit">搜索</a> <a href="javascript:;" class="easyui-linkbutton" data-options="plain:true" id="search_reset">重置搜索</a>
//搜索
$('#search_submit').click(function(){ table_search('#search_box .item',"table_id"); });
//重置
$('#search_reset').click(function(){ table_search_reset('#search_box .item',"table_id"); });

JS处理

/** * 表格搜索 */ 
function TableSearch(search_obj,id,action){ 
    var data = {}; 
    $(search_obj).children().each(function(){ 
        var id = $(this).attr('id'); 
        var com = $(this).attr('com');//选用哪一个组件 
        var multiple = $(this).attr('multiple');//多选 
        if(com){ 
            if(multiple != undefined){ 
                var val = eval("$(this)." + com + "('getValues')"); 
            }else{ 
                var val = eval("$(this)." + com + "('getValue')"); } 
        }else{ 
            var type = $(this).attr('type'); 
            if(type == 'radio' || type == 'checkbox'){ 
                var val = $('input:'+type+':checked').val(); 
            }else{ 
                var val = $(this).val(); 
            } 
        } 
        if(val) data[id] = val; 
        if($('#'+id+' select').length>0){ 
            $('#'+id+' select').each(function(){ 
                var key = $(this).attr('id'); 
                if($(this).val()){ 
                    data[key] = $(this).val(); 
                } 
            }); 
        } 
    }); 
    switch(action){ 
        case 'treegrid': 
            $('#'+id).treegrid('load',data); 
            break; 
        default:$('#'+id).datagrid('load',data); 
    } 
}
/** * 表格搜索重置 */ 
function TableSearchReset(search_obj,table){ 
    $(search_obj).children().each(function(){ 
        var com = $(this).attr('com'); 
        if(com != undefined){ 
            eval("$(this)." + com + "('clear')"); 
        }else{ 
            $(this).val(''); 
        } 
        var id = $(this).attr('id'); 
        if($('#'+id+' select').length>0){
            $('#'+id+' select').each(function(){ 
                $(this).val(''); 
            }); 
        } 
    }); 
    $('#'+table).datagrid('load',{}); 
}

/**
 * 获取分类下的所有子类
 * @param unknown $arrCat
 * @param number $parent_id
 * @param number $level
 * @param string $all
 * @return boolean|Ambigous <unknown, string, number>
 */
function get_category_child($arrCat, $parent_id = 0, $level = 0,$all=true){
	global $arrTree;
	if(!$all) $arrTree ='';
	if(empty($arrCat)) return false;
	$level++;
	if($level == 1) $arrTree[] = $parent_id;
	foreach($arrCat as $key => $value){
		if($value['pid' ] == $parent_id){
			//$value[ 'level'] = $level;
			$arrTree[] = $value['id'];
			unset($arrCat[$key]); //注销当前节点数据,减少已无用的遍历
			get_category_child($arrCat, $value['id'], $level);
		}
	}
	return $arrTree;
}
/**
 * 替换文章内容的图片
 */
function replace_img($content){
	$domain = 'http://'.$_SERVER['SERVER_NAME'];
	preg_match_all("/<(.*)(src=\"[^\"]+\")[^>]+>/isU", $content, $match);
	foreach($match[2] as $img){
		$content = str_replace($img, 'src="'.$domain.substr($img,5),$content);
	}
	return $content;
}