var windowId, proName = window.location.pathname.split("/")[1],
    sysUrl = "http://" + window.location.host + "/" + proName, toEdit;
var detectortype	= $.getUrlParam("detectortype");
$(function () {
    initDefault();
});

//默认
function initDefault() {

    initGrid();
}

//查询条件
function getQueryParams() {
    var sParam = {};

    sParam.LIKEname = $('#LIKEname').textbox("getValue");
	sParam.LIKEroadname = $('#LIKEroadname').textbox("getValue");
	sParam.detectortype=detectortype;
    sParam.order = " order by name"

    return sParam;
}

//加载列表
function initGrid() {
    var toolbar = [{
        text: '查询',
        iconCls: 'icon-search',
        handler: doSearch
    }];
    $('#tableGrid').datagrid({
        toolbar: toolbar,
        singleSelect: true,
        rownumbers: true,
        queryParams: getQueryParams(),
        url: 'detectorAction!listDetectorByPage.do',
        columns: [[
            {
                field: 'A',
                checkbox:'true',
                width:30
            },
            {field: 'id', title: '编码', hidden: true, width: 120},
            {field: 'name', title: '名称', hidden: false, width: 120},
            {
                field: 'bianma', title: '备案编码', hidden: false, width: 120,
            },
            {field: 'roadid', title: '道路编码', hidden: false, width: 120},
            {field: 'roadname', title: '道路名称', hidden: false, width: 120},
            {field: 'longitude', title: '经度', hidden: false, width: 120},
            {field: 'latitude', title: '纬度', hidden: false, width: 120},
            {field: 'regionid', title: '行政区划编码', hidden: false, width: 120},
            {field: 'regionname', title: '行政区划名称', hidden: false, width: 120},

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

