Slickgrid jQuery对话框编辑形式



我有一个slickgrid onClick事件,以打开一个jQuery对话框,以便当用户单击某个单元格时,我的数据电视中的某些字段和值填充了对话框。一切正常,但是我很难将表单数据保存回电网。我正在遵循此示例,但是我正在使用数据范围,因此我不确定是否需要进行一些更改。代码的这一部分启动,但是当对话框关闭时,数据范围未与表单数据更新。我缺少一块代码吗?谢谢

$modal.find("[data-action=save]").click(function () {
    grid.getEditController().commitCurrentEdit();
});

我不确定这是否是正确的方法,但这是我能够使用我有限的jQuery知识和数据视图的Wiki

来解决的方法
// find the button on the jQuery dialog and use this click event
 $('.ui-dialog-buttonset').find("[data-action=save]").on('click', function () {
    //these are the IDs for the inputs on my dialog
    var startDate = $('#dialog-StartDate').val();
    var dueDate = $('#dialog-DueDate').val();
    var lbsForJob = $('#dialog-LbsForJob').val();
    //I have a data attribute on my save buton that has the unique ID
    var dialogId = $('#editRowDialogSave').data('id');
    // per the wiki for data views, update the data view row
    var item = dataView.getItemById(dialogId);
    item['LbsNeededForJob'] = lbsForJob;
    item['StartDate'] = startDate;
    item['DueDate'] = dueDate;
    dataView.updateItem(dialogId, item);
});

最新更新