Accessing variable defined in slickgrid in AngularJs

user911

I have an array defined in slickgrid which captures the rows which are edited in the grid using OnCellChange event. I want to access this array in my angularjs Controller so that I can send the edited rows to backend. I have already searched for this question and I got to know that I need to use $window in my controller to access global js variable. But it's not working for me. I have read this How to access global js variable in AngularJS directive and this http://code.angularjs.org/1.1.5/docs/api/ng.$window

Infact in 2nd link(above) , many people have commented that it's didn't work for them either. Can anyone please tell me what am I missing?

Slick_grid.js

var editedRows = [];
    grid.onCellChange.subscribe(function(e , args){
      var item = args.item;
      for( i=0;i<editedRows.length; i++)
            {
             if(item.employeeId == editedRows[i].employeeId)
             {
                 editedRows.splice(i , 1 , item);
                 return;

             }
                else
             {
                 editedRows.push(item);
                 return;
             }
            }
    });

controller.js

myApp.controller('SubmitController' ,
    ['$scope' ,'$window', function($scope , $window)    {
     alert($window.editedRows);
     $scope.editedRows  =  $window.editedRows;

    }]);
Chandermani

I think the editedRows may have been defined within a function scope (javascript) and hence not accesible outside.

If editedRows is your own variable you can try

window.editedRows = [];

Not a good solution though.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

variable not defined in AngularJS

From Dev

Accessing Rails instance variable in AngularJS

From Dev

Accessing scope variable in function in AngularJS

From Dev

Accessing factory defined in another module in angularjs

From Dev

AngularJS - Accessing var in a service which are defined in a controller

From Dev

Parent accessing class variable defined in child in Python?

From Dev

Accessing global variable defined inside a function

From Dev

Accessing a variable from a defined function in a while loop

From Dev

Accessing global variable defined inside a function

From Dev

Accessing a variable from a defined function in a while loop

From Dev

AngularJS : accessing global variable within html template

From Dev

Angularjs: accessing scope variable array and calculating average

From Dev

AngularJS : accessing global variable within html template

From Dev

Accessing Controller variable in ng-repeat in AngularJS

From Dev

Gulp - Accessing gulpfile variable from AngularJS service

From Dev

Accessing python class variable defined inside the main module of a script

From Dev

Perl + recursive subroutine + accessing variable defined outside of subroutine

From Dev

dynamically creating bash variable and accessing its value defined earlier

From Dev

Accessing instance variable when defined in global in controller ruby on rails

From Dev

dynamically creating bash variable and accessing its value defined earlier

From Dev

"instance has no attribute button" when accessing a variable defined in __init__

From Dev

Accessing a global variable defined in a .cpp file in another .cpp file

From Dev

How to watch a variable defined in a service in angularjs

From Dev

Second variable in AngularJS not defined but declared in the same way

From Dev

Accessing $scope variable from another method in the same controller Angularjs

From Dev

Get AngularJS scope variable (inside javascript) defined in resolve/promise

From Dev

Comparing a variable defined from angularJS controller in HTML page

From Dev

Using object name when AngularJS variable is defined in $scope

From Dev

Unity C# – Accessing subclass properties from variable defined as derived class

Related Related

  1. 1

    variable not defined in AngularJS

  2. 2

    Accessing Rails instance variable in AngularJS

  3. 3

    Accessing scope variable in function in AngularJS

  4. 4

    Accessing factory defined in another module in angularjs

  5. 5

    AngularJS - Accessing var in a service which are defined in a controller

  6. 6

    Parent accessing class variable defined in child in Python?

  7. 7

    Accessing global variable defined inside a function

  8. 8

    Accessing a variable from a defined function in a while loop

  9. 9

    Accessing global variable defined inside a function

  10. 10

    Accessing a variable from a defined function in a while loop

  11. 11

    AngularJS : accessing global variable within html template

  12. 12

    Angularjs: accessing scope variable array and calculating average

  13. 13

    AngularJS : accessing global variable within html template

  14. 14

    Accessing Controller variable in ng-repeat in AngularJS

  15. 15

    Gulp - Accessing gulpfile variable from AngularJS service

  16. 16

    Accessing python class variable defined inside the main module of a script

  17. 17

    Perl + recursive subroutine + accessing variable defined outside of subroutine

  18. 18

    dynamically creating bash variable and accessing its value defined earlier

  19. 19

    Accessing instance variable when defined in global in controller ruby on rails

  20. 20

    dynamically creating bash variable and accessing its value defined earlier

  21. 21

    "instance has no attribute button" when accessing a variable defined in __init__

  22. 22

    Accessing a global variable defined in a .cpp file in another .cpp file

  23. 23

    How to watch a variable defined in a service in angularjs

  24. 24

    Second variable in AngularJS not defined but declared in the same way

  25. 25

    Accessing $scope variable from another method in the same controller Angularjs

  26. 26

    Get AngularJS scope variable (inside javascript) defined in resolve/promise

  27. 27

    Comparing a variable defined from angularJS controller in HTML page

  28. 28

    Using object name when AngularJS variable is defined in $scope

  29. 29

    Unity C# – Accessing subclass properties from variable defined as derived class

HotTag

Archive