我正在使用UIGrid。 如何在网格中获取所选单元格的DOM元素的行列对象?
$(".ui-grid-cell-focus")
这会为您提供当前焦点/所选单元格的HTML DOM。我正在尝试使用此HTML DOM值获取uiGrid row-col对象。我不知道怎么做!
答案 0 :(得分:0)
请尝试如下所示。
<强> JS 强>
var editCellTemplate = '<div class="ngCellText"><button class="btn btn-icon-only
green height-28" ng-click="grid.appScope.editProperty(row.entity.id)"><i
class="fa fa-edit"></i></button></div>';
vm.yourGridOptions = {
appScopeProvider: vm,
flatEntityAccess: false,
fastWatch: true,
showHeader: false,
columnDefs: [
{
name: 'id',
field: 'id',
width: 240,
},
{
name: 'Edit',
cellTemplate: editCellTemplate,
width: 40,
}
],
data: []
};
//edit property
vm.editProperty = function (id) {
// your logic here
};
答案 1 :(得分:0)
您可以尝试使用gridOptions声明:
onRegisterApi: function(gridApi){
gridApi.cellNav.on.navigate($scope,function(newRowcol, oldRowCol){
console.log(newRowcol);
});
}
请务必在网格指令视图中将ui.grid.cellNav注入角度模块和ui-grid-cellNav。 newRowcol是你的row-col对象