<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RunningNumber_Edit_Grid.aspx.cs" Inherits="Base_RunningNumber_Edit_Grid" Debug="true" %>
<%@ Register Src="~/Scripts/AWGridRuntime/UserControl/GridObject.ascx" TagPrefix="include" TagName="GridObject" %>
<%@ Register Src="~/Scripts/AWGridRuntime/UserControl/GridHeader.ascx" TagPrefix="include" TagName="GridHeader" %>


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <include:GridHeader runat="server" ID="GridHeader" />
    <script type="text/javascript" src="../../Scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
        var module_code = '<%=Request["module_code"]%>';
         //打印表体用的SQL
        var sql_print_detail_session_id = "<%=xview["sql_print_detail_session_id"]%>";
    </script>
</head>
<body>
    <form id="main_form">
        <!--列表标题与样式-->
        <style type="text/css">
            <%=xview["aw_column_style"]%>
        </style>
        <!--为控件提供参数与数据-->
        <script type="text/javascript">
            <%=xview["fields_index"]%>
            <%=xview["aw_grid_info"]%>
        </script>
        <!--创建列表控件-->
        <include:GridObject runat="server" ID="GridObject" />
    </form>
<script type="text/javascript">
    obj.setSelectionMode("multi-cell"); //开启单元格多选模式
    obj.setCellEditable(true, 4);//让可编辑
    //取消自带的双击事件
    obj.onRowDoubleClicked = function (event, row) {
    }

    //开始验证
    obj.onCellValidating = function (text, col, row) {

        //返回true代理验证不通过
        if (text == "" || isNaN(text)) {
            return true;
        }

    }
    //通过验证
    obj.onCellValidated = function (text, col, row) {
        if (col == 4) {
            var seed = aw_myData[row][3];
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: 'RunningNumber_Service.asmx/Save',
                data: "{module_code:'" + module_code + "',seed:'" + seed + "',current_number:'" + text + "'}",
                dataType: 'json',
                success: function (result) {
                    var r = result.d;
                    if (r == "success") {
                        parent.AlertOK("修改成功！");
                    } else {
                        parent.AlertNO(r);
                    }
                }
            });
        }
    }

    window.onload = function () {

    }
</script>
</body>
</html>
