表格未使用手动保存模式更新 [英] Table Not Updating With Manual Save Mode

查看:49
本文介绍了表格未使用手动保存模式更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个表来显示条目.用户单击按钮以打开片段页面以编辑数据.

So I have a table that shows the entries. Users click on a button to open a fragment page to edit the data.

app.datasources.SystemOrders.selectKey(widget.datasource.item._key);
app.showDialog(app.pageFragments.SystemOrders_Edit);

这部分工作正常.

我已将数据源更改为手动保存模式,以便能够利用Project Tracker示例中使用的更改时通过电子邮件发送通知"功能.为了使用户可以进行更改,请点击保存(关闭)"按钮,然后会显示一封电子邮件显示更改.

I have changed my datasource to Manual Save Mode to be able to utilize the "email notification for changes" functions that are used in the Project Tracker sample. So that a user can make changes, hit a Save (Close) Button and an email goes out showing the changes.

问题在于,当用户关闭片段时,表不会更新(它们具有相同的数据源).在自动保存模式下,我可以利用以下命令强制重新加载表,以反映所有更改:

The problem is that when the user closes the fragment, the table does not update (they have the same datasource). When I was in automatic save mode, I was able to utilize the following to force the table to reload so it reflected any changes:

var datasource = app.datasources.SystemOrders_HideComplete;
datasource.load();
app.closeDialog();

所以我想我只需要添加widget.datasource.saveChanges();关闭按钮的选项.

So I figured I just needed to add the widget.datasource.saveChanges(); option for the Close Button.

widget.datasource.saveChanges();
var datasource = app.datasources.SystemOrders_HideComplete;
    datasource.load();
    app.closeDialog();

不幸的是,当我使用上面的代码时,出现以下错误,并且表格似乎在尝试重新加载时卡住了(微调器一直在旋转).

Unfortunately, when I use the above I get the following error and the table seems like it gets stuck trying to reload (the spinner keeps spinning).

无法查询具有更改的模型上的记录."

我假设这可能是因为数据源在尝试重新加载数据源之前尚未完成保存新更改?

I'm assuming this is maybe because the datasource hasn't finished saving the new change, before trying to reload the datasouce?

我如何拥有保存(关闭)"按钮:

How can I have the Save (Close) Button:

保存更改

关闭对话框

刷新表以反映更改吗?

感谢您的帮助.

推荐答案

您可以尝试在保存回调中刷新数据源(假设您实际上是在页面片段和页面之间共享数据源):

You can try to refresh datasource in save callback(assuming that you are actually sharing datasource between page fragment and page):

widget.datasource.saveChanges(function() {
  widget.datasource.load();
  app.closeDialog();
});

这篇关于表格未使用手动保存模式更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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