【问题标题】:how to update changes made to jqgrid using inline edit?如何使用内联编辑更新对 jqgrid 所做的更改?
【发布时间】:2012-11-05 09:30:21
【问题描述】:

我们如何更新对 jqgrid 中特定行的单元格所做的更改....我想将其更新到数据库...我使用内联编辑进行编辑..我想更新该特定行到用户更改的数据库

这是我的 jquery 代码

    <script type="text/javascript">
    $(function () {
        var lastsel;
        jQuery("#list").jqGrid({
            url: '/Home/GetStudents/',
            datatype: 'json',
            mtype: 'POST',
            colNames: ['StudentID', 'FirstName', 'LastName', 'Email'],
            colModel: [
      { name: 'StudentID',sortable: false,key:true },
      { name: 'FirstName' },
      { name: 'LastName', sortable: false},
      { name: 'Email', width: 200,  sortable: false}],
      cmTemplate: {align: 'center', editable: true},
            pager: '#pager',
            width: 750,
            rowNum: 15,
            rowList: [5, 10, 20, 50],
            sortname: 'StudentID',
            sortorder: "asc",
            viewrecords: true,
            caption: ' My First JQgrid',
            onSelectRow: function (StudentID) {


                if (StudentID != lastsel) {


                    jQuery('#list').jqGrid('restoreRow', lastsel);
                    jQuery('#list').jqGrid('editRow', StudentID, true);

                    lastsel = StudentID;   
                }

            },

            editurl: '/Home/About/',
            caption: "Using events example"

        });
        jQuery("#list").jqGrid('navGrid', "#pager", { edit: false, add: false, del: false });
    });

</script>

【问题讨论】:

    标签: jquery asp.net-mvc jqgrid


    【解决方案1】:

    请检查以下示例项目:

    它包含(以及许多其他)用于内联编辑场景的示例。

    【讨论】:

    • 我在运行该应用程序时遇到问题,使用连接字符串,我不知道用于该应用程序的表结构,因此数据未加载且其给出错误
    • @beingfab 根据项目描述,您需要下载并安装Northwind Database,然后将连接字符串更改为指向它。
    • @beingfab Northwind 数据库包含应用程序正在使用的所有表和数据 - 您只需安装它。
    猜你喜欢
    • 2016-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-07
    • 2012-08-28
    • 2011-03-27
    • 1970-01-01
    • 2014-06-09
    相关资源
    最近更新 更多