{"id":7500,"date":"2014-06-19T21:37:20","date_gmt":"2014-06-19T21:37:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/angularjs-grid-not-working-when-place-the-code-under-a-event-collection-of-common-programming-errors\/"},"modified":"2014-06-19T21:37:20","modified_gmt":"2014-06-19T21:37:20","slug":"angularjs-grid-not-working-when-place-the-code-under-a-event-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/19\/angularjs-grid-not-working-when-place-the-code-under-a-event-collection-of-common-programming-errors\/","title":{"rendered":"AngularJs Grid &#8211; Not working when place the code under a event-Collection of common programming errors"},"content":{"rendered":"<p>Here is the code.<\/p>\n<p>Working version &#8211; Grid displays and page load.<\/p>\n<pre><code>\n\n    \n    Getting Started With ngGrid Example\n    \n    \n    \n    \n    \n        \/\/ main.js\n        var app = angular.module('myApp', ['ngGrid']);\n        app.controller('MyCtrl', function ($scope) {\n            $scope.myData = [{ name: \"Moroni\", age: 50 },\n                     { name: \"Tiancum\", age: 43 },\n                     { name: \"Jacob\", age: 27 },\n                     { name: \"Nephi\", age: 29 },\n                     { name: \"Enos\", age: 34}];\n            $scope.gridOptions = { data: 'myData' };\n        });\n\n    \n\n\n    \n    \n\n\n<\/code><\/pre>\n<p>Non working version. Moved the grid code under a button click.<\/p>\n<pre><code>\n\n    \n    Getting Started With ngGrid Example\n    \n    \n    \n    \n    \n        \/\/ main.js\n        var app = angular.module('myApp', ['ngGrid']);\n        app.controller('MyCtrl', function ($scope) {\n            $scope.LoadGrid = function () {\n                alert('');\n                $scope.myData = [{ name: \"Moroni\", age: 50 },\n                     { name: \"Tiancum\", age: 43 },\n                     { name: \"Jacob\", age: 27 },\n                     { name: \"Nephi\", age: 29 },\n                     { name: \"Enos\", age: 34}];\n                $scope.gridOptions = { data: 'myData' };\n            }\n        });\n\n    \n\n\n    \n        Load Grid\n    \n    \n\n\n<\/code><\/pre>\n<p>Getting the error : &#8211; TypeError: Cannot set property &#8216;gridDim&#8217; of undefined<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is the code. Working version &#8211; Grid displays and page load. Getting Started With ngGrid Example \/\/ main.js var app = angular.module(&#8216;myApp&#8217;, [&#8216;ngGrid&#8217;]); app.controller(&#8216;MyCtrl&#8217;, function ($scope) { $scope.myData = [{ name: &#8220;Moroni&#8221;, age: 50 }, { name: &#8220;Tiancum&#8221;, age: 43 }, { name: &#8220;Jacob&#8221;, age: 27 }, { name: &#8220;Nephi&#8221;, age: 29 }, { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7500","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7500"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7500\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}