内联编辑后的JQGrid setRowData [英] JQGrid setRowData After inline edit

查看:134
本文介绍了内联编辑后的JQGrid setRowData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进行内联编辑后更新行时遇到问题. 我的ColModel是:

I'm having a problem updating a row after an inline edit. My ColModel is:

colModel: [
    { name: 'Email', index: 'Email', editable: true },
    { name: 'ReferenceEmail', index: 'ReferenceEmail', editable: true },
      // hidden: true, editable: true, editrules: { edithidden: true}
    { name: 'Title', index: 'Title', editable: true, edittype: "select",
      editoptions: { value: "Mr:Mr;Mrs:Mrs;Ms:Ms;Doctor:Doctor;Sir:Sir"} },
    { name: 'Forename', index: 'Forename', editable: true },
    { name: 'Surname', index: 'Surname', editable: true },
    { name: 'Study_Manager', index: 'Study_Manager', editable: true,
      edittype: "select", editoptions: { value: "True:True;False:False"} }
]

我计划将referenceemail col值设置为新的已编辑电子邮件值,所以我有:

I plan to set the referenceemail col value = the new edited email value, so i have:

ondblClickRow: function (id, ri, ci) {
            lastSelUser = id;
            $("#UserGrid").editRow(id, true, false, reload);
        }

会在编辑成功后依次重新加载

which in turn calls reload onsuccess of the edit,

function reload(result) {
    var cell = $("#UserGrid").getCell(lastSelUser, 'Email');
    var newEmail = $(cell).val();
    $("#UserGrid").saveRow(lastSelUser, false);

    $("#UserGrid").setRowData(lastSelUser, { ReferenceEmail: newEmail });


    var ref = $("#UserGrid").getCell(lastSelUser, 'ReferenceEmail');
    alert($(cell).val());
    alert($(ref).val());

}

现在我的参考电子邮件没有得到更新-cell value的警报正确返回,但是ref(referenceemail) value的警报未定义,并且我已经检查了ID的正确性.

Now my reference email doesnt get updated - the alert of the cell value returns correctly, but the alert of the ref(referenceemail) value is undefined and i've checked that the id is infact correct.

我尝试将saverow放在setRowData之后,但这对结果没有影响.

I've tried putting the saverow after the setRowData, but that makes no difference to the outcome.

再一次, 我非常感谢您对该问题的所有见解.

Once again, I greatly appreciate any and all insight into the problem.

关于, 拜伦·科布

推荐答案

已经为任何想知道的人找到了部分解决方案. jqGrid editRow接受以下参数:

A partial solution has been found for anyone wondering. The jqGrid editRow accepts the following paramaters:

jQuery("#grid_id").editRow(rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc

.setRowData似乎不能在succesfunc中工作,但它确实可以在aftersavefunc中工作,所以我的新呼叫是$("#UserGrid").editRow(id, true, false, false, false, false, reload);而不是$("#UserGrid").editRow(id, true, false, reload);

.setRowData doesnt seem to work in the succesfunc, but it does work in aftersavefunc, so my new call is $("#UserGrid").editRow(id, true, false, false, false, false, reload); instead of $("#UserGrid").editRow(id, true, false, reload);

这篇关于内联编辑后的JQGrid setRowData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆