1

I have a modal dialog that opens up, after making changes and clicking save, its saving but not refreshing the data on the parent page, any help please?

        setViolationInactive: function () {
            var scope = this;

            console.log('content');
            console.log(this.get('content.ResultId'));

            let model = this.get('model');
            console.log('model 001');
            console.log(model);

            //validating form
            if ($("#edit-violationinactive-form").validate()) {
                var data = {
                    ViolationId: this.get('model.ViolationId'),
                    ResultId: this.get('content.ResultId'),
                    InactiveComment: this.get('inactiveComment'),
                };

                scope.api('InspectionItem/SetViolationInactiveResult').post(data).then(function (response) {
                    $('.modal').modal('hide');
                    toastr.success("Violation set Inactive.");
                    scope.transitionToRoute("result.details");
                    scope.get('result.details').refreshData();
                    scope.clearForm();
                }, function (error) {
                    $('.modal').modal('hide');
                    scope.transitionToRoute('result.details');
                    toastr.error("Error saving violation inactive.");
                });
            }
            else {
                toastr.warning("Please fix the form", "Validation failed");
            }
        },

Any help why is it not refreshing the result details page, the route for that one is: result.details, any help please?

2
  • you need to set something on your model in order to trigger a refresh. or you could use a tracked property or an observer like computed Commented May 21, 2021 at 9:30
  • any chance you could make a reproduction on ember-twiddle.com? it doesn't seem like there is enough context here, given the snippet. Also, what ember version are you on? the use of var and $ makes me think this is very old? Commented Jun 6, 2021 at 21:27

0

Browse other questions tagged or ask your own question.