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',{}); 
}