什么是colContainer属性,以及我可以在哪里找到它的文档

问题描述:

我最近几天刚开始发现ui-grid。 的ui.grid.class:GridOptions的文档显示关于如何使用该rowTemplate属性的示例:什么是colContainer属性,以及我可以在哪里找到它的文档

rowTemplate

'UI-格/ UI格列' 默认情况下。提供时,此设置使用自定义行模板。可设置一个模板文件的任何名称:

$scope.gridOptions.rowTemplate = 'row_template.html'; 

内嵌HTML

$scope.gridOptions.rowTemplate = '<div style="background-color: aquamarine" ng-click="grid.appScope.fnOne(row)" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell></div>'; 

正如你可以在rowTemplate HTML代码中看到有一个ng-repeat其中超过colContainer.renderedColumnscol项目进行迭代,并且有track by选项,它使用col.colDef.name

相同的模板也用于317_custom_templates tutorial example

我一直在寻找的文档中的colContainer财产的来源,我只能ui.grid.cellNav.object:CellNav下找到具有相同名称的属性没有任何细节(我已经不知道这是否正是使用了相同的colContainer财产在rowTemplate上面的例子,并在317_custom_templates tutorial example因为202 Cell Navigation tutorial有人说: > To enable, you must include the 'ui.grid.cellNav' module并在317_custom_templates tutorial example没有如注此模块) 还有下ui.grid.class:ScrollEvent属性sourceColContainer但它是不一样的poperty名称,但也许它可能是它的起源。

我想查找colContainer属性的文档并更好地理解它,并知道它的子属性(如果存在的话)(除colDef.name之外)或者至少我会知道它的来源并查看它的代码源if没有任何文档可能也是有用的。

此致敬礼。

+0

我发现col是来自类http://ui-grid.info/docs/#/api/ui.grid.class:GridColumn – Bardelman

我发现这个/src/js/core/directives/ui-grid-render-container.js:47

var colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName]; 

所以colContainer其实是在渲染容器,您可以访问外指令和模板做$scope.gridApi.grid.renderContainers["nameOfColContainer"]

知道nameOfColContainer你将不得不在这里检查您的模板


/src/templates/ui-grid/ui-grid.html:33):

<div ui-grid-render-container 
     container-id="'body'" 
     col-container-name="'body'" 
     row-container-name="'body'" 
     bind-scroll-horizontal="true" 
     bind-scroll-vertical="true" 
     enable-horizontal-scrollbar="grid.options.enableHorizontalScrollbar" 
     enable-vertical-scrollbar="grid.options.enableVerticalScrollbar"> 
    </div> 

所以这肯定是身体。在renderContainer中,您将拥有一个名为renderedColumns的对象,其中包含要呈现的列。 您还可以访问“身体”以外的其他容器:左右。 这是如果您使用固定的左侧和/或右侧,身体是中心容器。