记HTML5 JS jquery 关于给自画页面传递上一页面选定行的值的问题

记HTML5 JS jquery 关于给自画页面传递上一页面选定行的值的问题


1:自画页面获取主页面选定行值的方法
最开始需要获取主页面能传递的关键字段(一般都是序号ID),给自画页面传值最主要是需要一个关键的字段来获取值,由于是项目自带的成熟框架 URL调用查询对象就能通过关键的N_ID来获取到主面选定的行的值。
2: 自画页面传值方法:
$("#ID(input 文本框 id)").val(要传递的值) 这是jquery传递的方法
document.getElementById(“id”).value = 要传递的值(一般为JSON数组注意写法) 这是 JS 传递的方式

二级自画界面接收上一界面关键字段传值

<!DOCTYPE html>
@{
    string id = Request.QueryString["id"];        //这里一定要定义
    }
<script type="text/javascript">
    var idData = { "id": "@Html.Raw(Server.UrlDecode(id))" }      // 接收上一页面getselectedROW   对于N_ID字段值
    var topsRender = null;
    var grid = null;
    console.log(idData);
    $.ajax({
        type: "GET",
        url: '/AjaxGridData/SelDataAcquisitionId',
        data:idData,
        dealError: false,
        dataType: 'json',
        success: function (data) {
            if (data.IsSuccess) {                
                //var jsonobj = eval("(" + data.Data + ")");
                var jsondata = data.Data;
                                         //Edit_s_OrderDetailCode = jsondata[0].s_OrderDetailCode;      
                document.getElementById("Edit_s_OrderDetailCode").value = jsondata[0].s_OrderDetailCode;   //传递给input id value 值   (JS方法)重要!!!!
                document.getElementById("Edit_s_DeviceCode").value = jsondata[0].s_DeviceCode;
                document.getElementById("Edit_s_FactoryArea").value = jsondata[0].s_FactoryArea;
                document.getElementById("Edit_s_MachiningLineBody").value = jsondata[0].s_MachiningLineBody;
                document.getElementById("Edit_s_Series").value = jsondata[0].s_Series;
                //document.getElementById("Edit_s_Size").value = jsondata[0].s_Size;
                document.getElementById("Edit_d_DateTime").value = jsondata[0].d_DateTime;
                document.getElementById("Edit_Type").value = jsondata[0].Type;
                document.getElementById("Edit_s_Specifications").value = jsondata[0].s_Specifications;
                $("#Edit_s_Size").val(jsondata[0].s_Size);      //jquery   传递给input id value 值

            } else {
                alert("获取数据失败:" + data.Msgs[0]);
            }
        }
    });
   
    //value: "JSON.stringify(row[s_OrderDetailCode])"
   
</script>
<html>
    <head>
         </head>
   
 <body>      

<style>
  h2 {
    font-family: Lobster, Monospace;
  }
  p {
    font-size: 12px;
   }  
</style>

<h1 class="text-center">华为来料数据修改</h1>
     <form method="get">
        <p >工&nbsp 单&nbsp 号:&nbsp;<input  type="text" id="Edit_s_OrderDetailCode"  name="Edit_s_OrderDetailCode"/>
            机&nbsp 台&nbsp 号:&nbsp;<input  type="text" id="Edit_s_DeviceCode" name="Edit_s_DeviceCode" />
        <p >厂 &nbsp &nbsp &nbsp 区:&nbsp;<input type="text" id="Edit_s_FactoryArea" name="Edit_s_FactoryArea" /> 
            加工线体:&nbsp;<input type="text" id="Edit_s_MachiningLineBody" name="Edit_s_MachiningLineBody" /></p>
        <p >系 &nbsp &nbsp &nbsp 列:&nbsp;<input type="text" id="Edit_s_Series" name="Edit_s_Series" />
            规 &nbsp &nbsp &nbsp 格:&nbsp;<input type="text" id="Edit_s_Specifications" name="Edit_s_Specifications" /></p>
        <p >尺 &nbsp &nbsp &nbsp 寸:&nbsp;<input type="text" id="Edit_s_Size" name="Edit_s_Size" />
            日 &nbsp &nbsp &nbsp 期:&nbsp;<input type="text" id="Edit_d_DateTime" name="Edit_d_DateTime" /></p>
        <p >类 &nbsp &nbsp &nbsp 型:&nbsp;<input type="text" id="Edit_Type" name="Edit_Type" /></p>
        <button type="submit">提交修改</button>
    </form>
 </body>
    
</html>

index主页面修改按钮

$("#editBt").click(function () {
              var row = grid.getSelectedRow();
               
                if (!row) { alert('请选择要修改的行'); return; }
                f_addTab("Edit", "修改信息", "/DataAcquisition/Editdata?" + "id=" + row["n_Id"] + "&" + Math.random());
               
                console.log(row.s_OrderDetailCode);
               
                console.log(row);
                console.log(row["n_Id"]);
               
            });

`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值