i need to add a click event based on the cell data. how can i access the td tag to modify it's attribtues?
Hello,
There are no drawbacks in this approach. It works just as the one above (the one I posted).
Regards,Ivaylo HubenovEntry-level developer
i had tried that but it didn't work. this is what i did get to work:
$scope.gridOptions = {
cellClick: function (evt, ui) { cellClickHandler(evt, ui, gridData, ctrl.GridConfig, ApplicationService, productId, reportId, $scope); }
}
are there any drawbacks to this approach?
Hello Areen,
With angular 1.5.x it is basically the same thing. You should declare the event in the grid definition. You can see how in this link. Here is an example in your case:
<ig-grid data-source="northwind" width="100%" height="400px" primary-key="ProductID" event-cell-click="cellClickHandler"> //code</ig-grid>
And you also have to include function definition in the app controller. For example:
$scope.cellClickHandler = function (evt, ui) { alert(ui.colKey);}
Feel free to ask me any questions.
sorry, i should have specified that we're using angular 1.5.x
This event can be added to an angular application as well. The event has to be mentioned in the template and the function, that is to be fired on click has to be described (both in app.component.ts file). For example:
@Component({ selector: 'my-app', template: '(cellClick)="cellClickHandler($event)" >'})export class AppComponent { //code... constructor() { //code... this.cellClickHandler= function($event){ console.log("grid cell click"); alert($event.ui.colKey); }; }}