问题标签 [ag-grid]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2410 浏览

javascript - 如何读取 ag-grid 中每个单元格的样式(或获取 html 元素)

有没有办法遍历ag-grid并访问底层的 html 元素(或它的样式)?

它有forEachNode(callback). 但是回调只是在参数中给出整行和单元格值。我需要掌握单元格的样式。

0 投票
2 回答
3699 浏览

angularjs - $scope.gridOptions.api.setRowData 不起作用

我正在使用 ag-grid 。但我无法使用 $scope.gridOptions.api.setRowData 方法从 json 中绘制数据。仅显示标题。数据未在 UI 中绘制。

找到下面的代码

0 投票
7 回答
21254 浏览

angularjs - 如何使用 ag-grid 动态显示列

我是 angularjs 技术的新手。我正在使用 ag-grid 并希望动态显示列


我的json数据是:


我的预期输出是 预期输出

现有代码如下

现有输出在现有输出下方给出

如何从现有输出达到我的预期输出

0 投票
4 回答
26215 浏览

angularjs - ag-grid 的列排序不起作用

我有一个 ag-grid,我正在动态地将数据加载到其中。我启用了列排序,但它不起作用。当我单击列标题时没有任何反应。我不确定问题是什么。下面是我的代码:

0 投票
5 回答
36951 浏览

javascript - 如何在ag-grid中按索引获取节点?

AgGrid 期望将节点传递给它的许多数据函数。如何通过索引获取节点?看看下面的片段:

我可以将node参数传递给refreshRows()函数,因为我正在通过forEachNode().

如何在不迭代的情况下按索引获取节点forEachNode()

0 投票
1 回答
7961 浏览

angularjs - 当网格数据为空时,如何在 ag-grid 中显示覆盖“没有要显示的行”?

当网格数据为空时,如何在 ag-grid 中显示覆盖“没有要显示的行”?我得到了 'No rows to show overlay' ,但网格仍然显示之前获取的数据。

0 投票
2 回答
25824 浏览

javascript - ag-grid 将列标题设置为复选框,并选择全部或取消选择所有列,而不是仅组

使用 ag-grid 时,我想将第一列标题设置为复选框,并对除组以外的所有行执行全选或取消全选操作。

0 投票
1 回答
5430 浏览

typescript - 例外:在 AgGridNg2 上找不到指令注释

为什么这个带有 ag-grid 的 TypeSctipt 示例不起作用?

控制台有错误:

带有问题行的cars.ts代码:

我是否必须导入 AgGridNg2 以及如何做?或者也许当前版本的 Angular2 Beta 已损坏?

0 投票
4 回答
9265 浏览

ag-grid - 向网格中添加新行

我像这样初始化 ag-grid:

<ag-grid-ng2 [rowData]="records"></ag-grid-ng2>

将新项目添加到记录数组后,ag-grid 中的行保持不更新。我必须调用 setRowData(records)。但这非常慢,并且 ag-grid 会失去其状态(如聚焦单元格)。

是否有另一种方法可以在更改rowData.

0 投票
1 回答
1503 浏览

angularjs - Build errors in ag-grid source ts files when using ag-grid installed with bower in an AngularJs with Typescript project

I have found 2 issues with the way ag-grid dependency is structured and with its documentation. Hopefully somebody can refer me to a good typescript Angular1.x samples where ag-grid is used.

I have a basic AngularJs SPA project I installed "ag-grid": "3.1.0" with bower install ag-grid by adding the dependency to my bower.json in Visual Studio 2015 and as result it adds under bower_components the following structure: ag-grid | |-- dist |--src | |--ts | ...

The problem I have is that unless I physically delete the /bower_components/ag-grid/src folder, Visual Studio will show 926 errors within ts files under that source folder. Error such as:

and many duplicate issues between bower_components/ag-grid/dist/ag-grid.ts and bower_components/ag-grid/src/ts/widgets/agDropdownList.ts such as:

I understand there are TS classes and other names duplicated and Visual Studio 2016 does not like that. But is this an expected result? Why to have the sources included in a bower dependency. Is it in case I want to generate (with Gulp for example) my own dist/ag-grid.js? If so why to include then the dist/ag-grid.ts folder if it's going to conflict?

I am not too familiar with front-end development and task-runner strategies so maybe this is a common practice and developers are supposed to delete the /bower_components/ag-grid/src folder.

If instead deleting the /bower_components/ag-grid/src folder I delete the bower_components/ag-grid/dist/ag-grid.ts I still get 13 errors such as

and it even has a reference to /// <reference path="../../typings/tsd" /> that is broken as there is no typings folder at all.

It feels as if this dependency was a little bit messy, doesn't it?

The other thing that makes me confused about ag-grid is that in the sample it says that an AngularJs controller would need the ngGrid dependency. However this dependency is not being used. This is my example without this dependency injected:

The view:

The typescript controller:

That works properly as long as my server serves the JS dependency and 2 css:

I guess what I am asking for is a clarification on why the bower dependency is structured in such a way, what is the common practice when developing with such dependency for VS not to complain about TS errors and a clarification on whether the agGrid dependency is necessary at all to be injected in AngularJs controllers. :-) Thank you!