Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngGrid due to:
Error: [$injector:nomod] Module 'ngGrid' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Run Code Online (Sandbox Code Playgroud)
以上是我收到的错误消息.我已经加载了ng-grid脚本AFTER angularjs,jquery.我将它注入应用程序,如下所示:
var myApp = angular.module('myApp', ['ui.bootstrap','ngRoute', 'ngResource','ngGrid'])
.controller('myAppCtrl', myAppCtrl);
Run Code Online (Sandbox Code Playgroud)
我想知道我哪里做错了?
=== UPDATE
这是我的标题
<!-- Angular Libs -->
<script type="text/javascript" src="/library/angularjs/1.2.9/angular.js"></script>
<script type="text/javascript" src="/library/angularjs/1.2.9/angular-route.js"></script>
<script type="text/javascript" src="/library/angularjs/1.2.9/angular-resource.js"></script>
<!-- jQuery …Run Code Online (Sandbox Code Playgroud) 我正在测试角度ui-grid 3.0.0.以下是旧版本的示例代码,selectedItems在选中时应包含一些对象.在版本3中,它似乎不起作用.有人遇到过同样的行为吗?
Angularjs版本:1.3.11 Angular-ui-grid:3.0.0-rc.16这里是我控制器的一些提取代码:
$scope.gridOptions = { };
$scope.mySelections = [];
$scope.gridOptions = {
enableRowSelection: true,
enableRowHeaderSelection: false,
modifierKeysToMultiSelect: true,
multiSelect: true,
pagingPageSize: 25,
useExternalPagination: true,
useExternalSorting: true,
selectedItems: $scope.mySelections
};
$scope.changeDelete = function () {
$log.debug('Selection length = ' + $scope.mySelections.length);
if ($scope.mySelections.length > 0) {
$location.path("/EREditHospitalChange/");
}
$location.path("/EREditHospitalChange/LYNDA");
}
Run Code Online (Sandbox Code Playgroud)
// mySelections.length始终为0.
他是html页面中的网格声明:
<div ui-grid="gridOptions" ui-grid-selection ui-grid-pagination ui-grid-edit class="grid"></div>
<pre>{{mySelections}}</pre>
</fieldset>
<button ng-click="changeDelete()">Change/Delete</button>
[] This is what is visible in {{mySelections}}
Run Code Online (Sandbox Code Playgroud) 如果每个父行在其子网格中具有相同数量的子行,并且因此具有相同的高度,则ui-grid的可扩展行功能非常有用.如果subGrid中的子行数与父行的行数不同,则不是很好.
我已经能够通过传入数组长度并使用它生成subGrid-height来使subGrid ITSELF具有动态高度:
lengthOfList: data[i].friends.length
style="height:{{row.entity.subGridOptions.lengthOfList * 30}}px;
Run Code Online (Sandbox Code Playgroud)
但由于该子网格必须在父网格中存在,因此父网格需要向下推动其行以腾出空间.它需要通过每行不同的amonut来实现.不幸的是,父网格对于所有行都有一个固定的expandableRowHeight.我无法为EACH行指定expandableRowHeight.
我希望最好的是动态改变expandableRowHeight,因为我点击一行打开它.
试图找出如何监听开放的可扩展行事件.
ui-grid是一个收缩包装插件,它编写自己的DOM元素,因此我无法向可能帮助我捕获事件的元素添加任何内容.
如何在运行中配置expandableRowHeight?
Plunker:
http://plnkr.co/edit/1IeEsXZAf9pRgKmy5jfO?p=preview
(the plunker行为不端.1]由于跨域问题,ui-grid正在使用的字体现在被阻止,2]有时html模板因为没有明显的原因而变为AWOL.)
对于Plunker链接中的分组ui网格,第三列,如何让按钮仅显示在groupHeader行中?
Plunker:http://plnkr.co/edit/KNNUPhAmD91HeHkDaQyr?p=preview
我尝试在第三列使用以下cellTemplate,但它不起作用,因为第三列不是分组列.
cellTemplate: '<div ng-if="!col.grouping || col.grouping.groupPriority === undefined || col.grouping.groupPriority === null || ( row.groupHeader && col.grouping.groupPriority === row.treeLevel )" class="ui-grid-cell-contents" title="TOOLTIP">{{COL_FIELD CUSTOM_FILTERS}}</div>'
Run Code Online (Sandbox Code Playgroud)
网格的大多数代码来自官方UI网格教程209.我刚刚添加了按钮部分.
基于此帮助链接,我能够实现颜色更改,但在此解决方案中,它将颜色应用于整行,这不是我正在寻找的.
我想更改唯一编辑过的单元格的颜色.如果有人有任何想法,请分享.谢谢.
我有一个网格,有一个外部"显示详细信息"选项,可以向网格添加更多列.
问题是"导出所有数据"与"导出可见数据",这在此时变得欺骗.
我知道可见数据是加载数据的,但在这种情况下,所有数据都会立即加载.因此,用户会认为"可见数据"将是他们所看到的,并且"所有数据"还将包括在单击"显示详细信息"时添加的列,但遗憾的是不是这种情况.
是否可以自定义网格菜单?或者至少隐藏"导出可见数据"选项?
请帮忙!谢谢.
参考:http://ui-grid.info/docs/#/api/ui.grid.exporter.api : GridOptions
我在我的应用程序中使用了 angular ui-grid,我的页面包含简单的文本框和验证按钮。通常我们在文本框中添加一些字符串并点击验证按钮,这些将通过一些外部服务进行验证并在 ui-grid 中显示数据
我的逻辑像冠军一样工作,但我看到有些东西会给用户带来一些困惑。假设我"Event 87654"在我的文本框中添加类似的内容并单击验证按钮,它会从我的服务中成功验证并像"Event 87654"在数据网格中一样显示。所以事情就是为什么ui grid会自动消除给定字符串中的多个中间空格??有没有可能避免这种消除?任何人都可以在这方面建议我。
我注意到,当我使用数值对列进行排序时,它似乎没有正确排序.例如,我有一个包含以下数字的列:565,5786,6335,6351,61447.当我对列(DESC)进行排序时,数字的排序如下:
问题似乎在于排序数字与文本.
作为参考我使用"angular-ui-grid":"~3.1.1"
单击"添加行"按钮时,它在ui-grid顶部添加了一个新行,其焦点为第一列.按Tab键后,它不会转到同一行的Next Column,而是转到下一行列.
http://plnkr.co/edit/VYhhIpdUAUzoXr2RiYKG?p=preview Here is my code in [plnkr]
请咨询.
我正在使用ui-grid来显示数据列表并在显示网格时我试图根据数据扩展一些行.
我想在onRegisterApi事件中这样做:
scope.GridOptions = {
data: properties,
columnDefs:
[
{ name: "Full Address", field: "FullAddress" },
{ name: "Suburb", field: "Suburb" },
{ name: "Property Type", field: "PropertyType" },
{ name: "Price", field: "Price", cellFilter: 'currency'},
{ name: "Status", field: "Status" },
{ name: "Sale Type", field: "SaleType" },
{ name: "Date Created", field: "CreateDate", cellFilter: "date:'dd/MM/yyyy HH:mma'"}
],
expandableRowTemplate: 'template.html',
expandableRowHeight: 200,
onRegisterApi: (gridApi) =>
{
gridApi.expandable.expandAllRows();
}
};
Run Code Online (Sandbox Code Playgroud)
问题是gridApi.expandable.expandAllRows()扩展所有分组部分.我看到有一个expandRow功能,但我不知道如何使用它来代替expandAllRows …