【问题标题】:Refresh page after APIQuickAction submissionAPIQuickAction 提交后刷新页面
【发布时间】:2020-12-06 15:18:40
【问题描述】:

我是 Lightning 组件开发的新手,我正在尝试实现一个带有多个操作的闪电:数据表,例如添加新行、删除行和创建新行。

要创建一条线,我使用的是快速操作,我使用 quickActionAPI 调用它:

var actionAPI = component.find("quickActionAPI");
var args = { actionName :"Contrat_cadre__c.My_rule"};
var anAction = actionAPI.selectAction(args)
.then(function(result) {
      
})
.catch(function(e) {
    if (e.errors) {
        alert('The action is unavailable');
    }
});

它按预期工作,但我需要手动刷新页面才能看到我的数据表中的新行。但是我不知道如何捕捉快速动作的提交。

【问题讨论】:

    标签: salesforce salesforce-lightning


    【解决方案1】:
    【解决方案2】:

    感谢您的回答,这是我尝试过的:

    在 controller.js 中:

    var anAction = actionAPI.selectAction(args)
    .then(function() {
        console.log('enter in then');
        helper.refreshPage();
    })
    

    在 helper.js 中:

    refreshPage: function (component)
    {
        console.log('helper method');
        var action = component.get('c.**myApexController**');
        action.setCallback(component,
            function(response) {
                var state = response.getState();
                console.log(state);
                if (state === 'SUCCESS'){
                    console.log('success');
                    $A.get('e.force:refreshView').fire();
                } else {
                    //do something
                }
            }
        );
        $A.enqueueAction(action);
    }
    

    似乎 then 是在调用动作时触发的,所以在动作提交之前。 (此时console.log显示“enter in then”和“helper method”,其他日志根本不显示)

    【讨论】:

      猜你喜欢
      • 2013-08-26
      • 1970-01-01
      • 2012-05-25
      • 1970-01-01
      • 1970-01-01
      • 2013-02-09
      相关资源
      最近更新 更多