var windowId,proName = window.location.pathname.split("/")[1],sysUrl = "http://"+window.location.host+"/"+proName,toEdit;
var num=0;
$(function(){
	initDefault();	
});
//默认
function initDefault(){
	
	initGrid();
}
//查询条件
function getQueryParams(){
	var sParam = {};
	sParam.LIKEmachinename = $('#LIKEmachinename').textbox("getValue");
	sParam.order = "order by createtime desc "
	return sParam;
}
//加载列表
function initGrid(){	
	var toolbar = [
	{
    	text	:	'查询',
        iconCls	:	'icon-search',
        handler	:	doSearch
    }];
	$('#searchGrid').datagrid({
		toolbar : toolbar,
		singleSelect:false,
		rownumbers:true,
		queryParams:getQueryParams(),
		url : 'ywmachineinfoAction!listYwmachineinfoByPage.do',
		columns : [[
		    {
				field: 'A',
				checkbox:'true',
				width:30
			},
		    {field:'machineid',title:'machineid',hidden:true,width:120, 
				formatter:function showClick(value,record,num){ 
					return "<a  href='javascript:void(0);' class='ahref' onclick='doUpdate("+num+")'>"+value+"</a>";
				}
 			},
			{field:'machinename',title:'服务器名称',hidden:false,width:120},
			{field:'machineip',title:'服务器ip',hidden:false,width:100},
			{field:'csmc',title:'是否启用',hidden:false,width:80}
		]],		
		onClickRow:function(index,row){
			num = index
			setchecked();
		},
		onLoadSuccess:function(){
			$("#searchGrid").datagrid("selectRow",num);
			
		}
	});
}

//查询
function doSearch(){	
	$('#searchGrid').datagrid('load',getQueryParams());
}


	
	function getSelectedRows(){
		var rows = $('#searchGrid').datagrid('getChecked'); 
		return rows;	
	}
	
