2014-10-18 91 views
1

我試圖角度ui網格(http://ui-grid.info),我不知道如何指定一個div ID爲選定的單元格?當我點擊它突出一個細胞,但我想在點擊(彈出...信息...文本...等)的一些jQuery的事件div id爲角度ui網格單元格選擇

這是原稿單元選擇:

<div tabindex="-1" class="ui-grid-cell-contents ng-scope ng-binding">Username</div> 

<div id="username-1234" tabindex="-1" class="ui-grid-cell-contents ng-scope ng-binding">Username</div> 

代碼:我的網格

var app = angular.module('app', ['ui.grid', 'ui.grid.cellNav', 'ui.grid.pinning']); 

app.controller('MainCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) { 

    $scope.gridOptions = { }; 

    $scope.gridOptions.columnDefs = [ 
     { field:'fullname', width:150, pinnedLeft: true, displayName: 'Name' }, 
     { field:'Day01', width:50, displayName: '01' }, 
     { field:'Day02', width:50, displayName: '02' }, 
     { field:'Day03', width:50, displayName: '03' }, 
     { field:'Day04', width:50, displayName: '04' }, 
     { field:'Day05', width:50, displayName: '05' } 
]; 

示例圖片:我如果能夠得到這樣的疑惑enter image description here

回答

2

您可以使用cellTemplate

可以得到的東西,如:

<div id="username-1234" tabindex="-1" class="ui-grid-cell-contents ng-scope ng-binding">Username</div> 

我不知道什麼是 「1234」,所以用字段名像這樣:

<div id="username-fieldname" tabindex="-1" class="ui-grid-cell-contents ng-scope ng-binding">Username</div> 

這是手機模板

'<div id={{row.entity.name}}-{{col.colDef.name}} class="ui-grid-cell-contents"> {{COL_FIELD CUSTOM_FILTERS}}</div>' 

Here is Plunker

P.S 名{{row.entity.name}}是字段名稱,你的情況是全稱,例如像這樣:

'<div id={{row.entity.fullname}}-{{col.colDef.name}} class="ui-grid-cell-contents"> {{COL_FIELD CUSTOM_FILTERS}}</div>'