Update No. 1: after the correction that I commented on, my application now starts, but the grid does not appear, except for its bounding box and the filter button and pop-up window. However, I do not get errors from the console, and as far as I can with the debugger, I see that the data received from the server is in order. If I use Batarang, I can see the area corresponding to my model, correctly filled with objects. I updated the downloadable playback solution accordingly. Can someone explain why ng-grid is not updating here?
I start playing with ng-grid and TypeScript, and I find problems as soon as the test application starts. See the bottom of this post for a link to a complete test solution. Of course, I made a lot of mistakes even in these few files, but I would like to start something to start and step by step.
An MVC application has two client applications:
app.js for default view (Home / Index). There is no TypeScript here, and all the code is self-contained in this single file. The code is derived from the swap example in the documentation for the ng-grid and tries to remain as simple as possible.
MyApp.js for a more realistic sample in a different view (Home / Model). This example uses services, models, and controllers, and its JS code is compiled from TypeScript. To keep things simple, I just store these components in Scripts / App, in folders for controllers, models and services, and each file contains only one class or interface. Generated JS files are manually included in the view.
app.js works, except that it has filtering problems. I wrote about this here: Server-side filtering with ng-grid: binding problem?
MyApp.js has problems running ng-grid. As soon as the application starts, TypeError is thrown into the grid binding:
TypeError: Cannot set property 'gridDim' of undefined at ngGridDirectives.directive.ngGridDirective.compile.pre (http://localhost:55203/Scripts/ng-grid-2.0.7.js:2708:37) at nodeLinkFn (http://localhost:55203/Scripts/angular.js:4392:13) at compositeLinkFn (http://localhost:55203/Scripts/angular.js:4015:15) at nodeLinkFn (http://localhost:55203/Scripts/angular.js:4400:24) at compositeLinkFn (http://localhost:55203/Scripts/angular.js:4015:15) at publicLinkFn (http://localhost:55203/Scripts/angular.js:3920:30) at resumeBootstrapInternal (http://localhost:55203/Scripts/angular.js:983:27) at Object.$get.Scope.$eval (http://localhost:55203/Scripts/angular.js:8057:28) at Object.$get.Scope.$apply (http://localhost:55203/Scripts/angular.js:8137:23) at resumeBootstrapInternal (http://localhost:55203/Scripts/angular.js:981:15) <div ng-grid="gridOptions" style="height: 400px" class="ng-scope"> angular.js:5754
The only similar problem that I found while working with googling is https://github.com/angular-ui/ng-grid/issues/60 , but it does not seem to be relevant to my case, since there the grid parameters were installed too late.
On the server side, there is only a RESTful API that returns server-side, sorted, and filtered items.
Here you can find the complete solution for replication (just save, unzip and open all the dependencies on NuGet); see readme.txt file for more information:
http://sdrv.ms/167gv0F
Just launch the application and click "MODEL" in the upper right corner to launch the TypeScript application, throwing an error. The entire application consists of 1 controller, 1 service and 1 model.
For starters, like me, it would be nice to have a simple working example like this. Can anyone help?