0

In my view model I have a grid, if user click on Edit button on the row it will popup a dialog with row values, if user click on Edit button will close the dialog then I need to reload the grid. My model look like below, I my case I am not able to call load function after dialog call back (** getting Error - self is undefined**). it is possible to pass this to dialog?

var ctor = function () {
         var self = this;
         self.load = function () {
             Load grid Functions
         }
         self.editRow = function (row) {
             dialog.show(new editWindow(), row).then(function (response) {
                 if (response == null) {
                     return;
                 }
                 self.load();
             });
         }

         Return ctor;
rook ....
  • 156
  • 2
  • 14

1 Answers1

0

got answer by adding self with call back

var ctor = function () {
         var self = this;
         self.load = function () {
             Load grid Functions
         }
         self.editRow = function (row) {
             dialog.show(new editWindow(), row).then(function (response) {
                 if (response == null) {
                     return;
                 }
                 self.load();
             },self);
         }

         Return ctor; 
rook ....
  • 156
  • 2
  • 14