AngularJS ui-grid with TYPESCRIPT

1,409 views
Skip to first unread message

Suparn Badwaik

unread,
Oct 22, 2015, 2:34:44 PM10/22/15
to AngularJS
Hi,

I am new with Angularjs and typescript. Can anyone please help me with my query ?

I have a very simple grid comprising of 3 columns and a Delete button corresponding to each row. The data is bind to the grid as expected.
How can i find out which row has been clicked ? 

I was able to achieve this using plain Javascript. I want to write the code purely in typescript.

Below is my code if needed to know what i have done.
code within the constructor of the controller :
            this.gridOptions = {};
            this.gridOptions.columnDefs = [{ name: "Name" }, { name: "Language" }, {
                name: 'Remove',
                cellTemplate: '<button class="btn btn-primaryRemove btn-xs" ng-click="grid.appScope.showMe()">Remove</button>'
            }];

Function within the constructor:
           showMe(): void {
                alert("Hi");
            }

Initially, i was trying to find out the row details, but later realized that a simple function is not getting called either.
This works when i tried using javascript with angularjs.

Help needed :
1. Why is the function not being called ?
2. If the function gets called, how can i get the row details ?
3. Can anyone share some good articles or tutorials or any material that would help me in using angular with typescript ?

Any help would be appreciated. Thank you,

Nick Carter

unread,
Oct 22, 2015, 3:54:25 PM10/22/15
to AngularJS
See the tutorials on selection (http://ui-grid.info/docs/#/tutorial/210_selection) and editing (http://ui-grid.info/docs/#/tutorial/201_editable) depending on your needs. There are events built into ui-grid for this.

Suparn Badwaik

unread,
Oct 22, 2015, 9:38:03 PM10/22/15
to AngularJS

Hi Nick. How are you?

Thanks for your reply. These links contain all the demos that could be done with ui grid.

My problem however is that, i am able to perform the button click event inside the grid when i tried using javascript code. But when i use Typescript the code doesnt work.
If the same code mentioned below would have been written in Javascript, it would have worked.

My pain area as of now is using angular with Typescript.
Thanks for the reply though.

Suparn B

unread,
Oct 22, 2015, 9:43:46 PM10/22/15
to AngularJS
I am refering the example 305 of the ui grid (http://ui-grid.info/docs/#/tutorial/305_appScope).
The click button doesnt work or better to say i am not getting what mistake i am making when using Typescript. The same works with Javascript.
Reply all
Reply to author
Forward
0 new messages