Using Angular UI-Grid, how do you access row entity data without using row select?

I am trying to switch from Smart-Table version 1.x to Angular ui-grid (version 3.0) by replacing ng-grid. <i> I like almost everything about ui-grid, but one thing is driving me crazy. The smart table has a value for dataRow , which is a convenient way of referencing an object in the table.

What I used for this was filling out an html template to include the field information from the object, something like ng-click="$parentScope.edit(dataRow.id)" in the html template placed in the grid cell.

However, in ui-grid, I cannot access an entity object without formally selecting a row or cell. Any attempts to include it in the cell template result in an object ( row.entity ), but I can’t access any entity elements, they are displayed as undefined. Any ideas?

In addition, I was able to execute the method in an html template, but only those that have no parameters, and not one trying to use the parameter from the object itself.

Here is my html template that worked with a smart table:

 <a data-toggle="tooltip" data-placement="top" title="View {{filteredRowCollection}}" ng-click="$parent.$parent.$parent.$parent.view(dataRow.id)" class="glyphicon glyphicon-camera green"> </a> <a data-toggle="tooltip" data-placement="top" title="Edit {{selectionId}}" ng-click="grid.appScope.edit(row.entity.id)" class="glyphicon glyphicon-pencil blue"> </a> <a data-toggle="tooltip" data-placement="top" title="Delete {{selectionId}}" ng-click="$parent.$parent.$parent.$parent.delete(dataRow.id)" class="glyphicon glyphicon-trash red"> </a> 

I tried to use something like this using ui-grid:

 function edit(row){ . . . }; 

row , at the moment it is an object, like row.entity . I expected that I could use something like row.entity.id , one of the fields, but it is undefined .

+5
source share
1 answer

This post may be helpful, https://technpol.wordpress.com/2014/08/23/upgrading-to-ng-grid-3-0-ui-grid/

Basically, you need to set the outer area for your grid so that you can access the data.

+4
source

Source: https://habr.com/ru/post/1213564/


All Articles