ng-grid col.naam cellTemplate不起作用

时间:2014-10-26 10:25:54

标签: angularjs ng-grid

这是columnDefs数组的一部分:

{field: 'naam', displayName: 'naam', cellTemplate: '<div>{{row.getProperty(col.naam)}}</div>', enableCellEdit: true}, 
{field: 'naam', displayName: 'naam', enableCellEdit: true}, 

第一行无所作为。第二个是正常工作。可能是实施方面的小问题?

columnDefs: [{field: 'show', displayName: 'show', enableCellEdit: false, cellTemplate: '<span class="ngCellText cursor-pointer" ng-click=navEdit(row.getProperty(\'naam\'),row.getProperty(\'crediteurnummer\'));>show</span>'},
        //{field: 'show', displayName: 'show', enableCellEdit: false, cellTemplate: '<span class="ngCellText cursor-pointer"><input type="checkbox" name="vehicle" value="Bike"></span>'},
        {field: 'naam', displayName: 'naam', cellTemplate: '<div>{{row.getProperty(col.naam)}}</div>', enableCellEdit: true}, 
        {field: 'naam', displayName: 'naam', enableCellEdit: true}, 
        {field:'crediteurnummer', displayName:'crediteurnummer', enableCellEdit: true},
        {field:'plaatsnaam', displayName:'plaatsnaam', enableCellEdit: true},
        {field:'land', displayName:'land', enableCellEdit: true}],
        rowTemplate:'<div style="height: 100%; color: #428bca;" ><div ng-style="{ \'cursor\': row.cursor }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell ">' +
        '<div class="ngVerticalBar" ng-style="{height: rowHeight}" ng-class="{ ngVerticalBarVisible: !$last }"> </div>' +
        '<div ng-cell></div>' +
        '</div></div>'
    };

1 个答案:

答案 0 :(得分:1)

像这样写下cellTemplate:

{field: 'naam', displayName: 'naam', cellTemplate: '<div>{{row.entity.naam}}</div>', enableCellEdit: true},

这应该可以解决问题。