如何在 Syncfusion 网格中添加 angularJs 或使 syncfusion 行可点击和 运行 angularjs 功能
How to add angularJs in Syncfusion grid or make the syncfusion rows clickable and run angularjs functions
我正在使用 angularJs 和 Syncfusion 在 table 中显示数据。因此,为此我使用了 Syncfusion 网格 (https://help.syncfusion.com/angularjs/grid/overview)。
但是我无法在这个网格中使用 angularjs 函数:
<div class="table-responsive grid-toggle">
<div id="GridId" ej-grid e-datasource="TableData"
e-allowfiltering="true" e-allowpaging="true" e-allowsorting="true" e-enabletouch="false" e-responsive="true"
e-allowselection="true" e-filtersettings-filterType="excel" e-allowtextwrap="true" e-recorddoubleclick="Get">
<div e-columns>
<div e-column e-field="Id" e-headertext="{{TableData.Id}}" e-width="2" ng-click="func()"></div>
<div e-column e-field="Nums" e-headertext="Nums" e-width="1"></div>
<div e-column e-field="Fams" e-headertext="Fams" e-width="2"></div>
</div>
</div>
</div>
所以在上面的代码中 - 第一列 e-headertext
不起作用,ng-click
.
也不起作用
有人可以帮助我应对这个挑战吗?我只想使 table 动态化并在网格中添加可点击的行。
由于过滤器 excel 设置,我想坚持使用 syncfusion。
提前致谢。
感谢您联系 Syncfusion 支持。
查询 1:e-headertext 不工作
我们已经修改了您的代码并通过从范围变量设置 headerText 实现了您的要求。
请检查下面的代码片段和示例,
<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true" e-allowfiltering="true"
e-filtersettings="filterType" >
<div e-columns>
<div e-column e-field="OrderID"></div>
<div e-column e-field="CustomerID" e-headertext="headerText"></div>
<div e-column e-field="ShipCity"></div>
</div>
</div>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope,$rootScope) {
$scope.data = window.gridData;
$scope.headerText = "test header";
});
</script>
样本:http://jsplayground.syncfusion.com/d4nfnple
查询 2:在网格中添加可点击的行
我们建议您使用grid 的rowSelected 事件使行可点击并根据点击执行操作。您也可以启用 CellSelection 并使用 cellSelected 事件。请查看以下API和帮助文档,
行选择:https://help.syncfusion.com/angularjs/grid/selection#row-selection
单元格选择:https://help.syncfusion.com/angularjs/grid/selection#cell-selection
CellSelected 事件:https://help.syncfusion.com/api/js/ejgrid#events:cellselected
RowSelected 事件:https://help.syncfusion.com/api/js/ejgrid#events:rowselected
如需进一步帮助,请回复我们。
此致,
Padmavathy Kamalanathan
我正在使用 angularJs 和 Syncfusion 在 table 中显示数据。因此,为此我使用了 Syncfusion 网格 (https://help.syncfusion.com/angularjs/grid/overview)。
但是我无法在这个网格中使用 angularjs 函数:
<div class="table-responsive grid-toggle">
<div id="GridId" ej-grid e-datasource="TableData"
e-allowfiltering="true" e-allowpaging="true" e-allowsorting="true" e-enabletouch="false" e-responsive="true"
e-allowselection="true" e-filtersettings-filterType="excel" e-allowtextwrap="true" e-recorddoubleclick="Get">
<div e-columns>
<div e-column e-field="Id" e-headertext="{{TableData.Id}}" e-width="2" ng-click="func()"></div>
<div e-column e-field="Nums" e-headertext="Nums" e-width="1"></div>
<div e-column e-field="Fams" e-headertext="Fams" e-width="2"></div>
</div>
</div>
</div>
所以在上面的代码中 - 第一列 e-headertext
不起作用,ng-click
.
有人可以帮助我应对这个挑战吗?我只想使 table 动态化并在网格中添加可点击的行。 由于过滤器 excel 设置,我想坚持使用 syncfusion。
提前致谢。
感谢您联系 Syncfusion 支持。
查询 1:e-headertext 不工作
我们已经修改了您的代码并通过从范围变量设置 headerText 实现了您的要求。
请检查下面的代码片段和示例,
<div id="Grid" ej-grid e-datasource="data" e-allowpaging="true" e-allowfiltering="true"
e-filtersettings="filterType" >
<div e-columns>
<div e-column e-field="OrderID"></div>
<div e-column e-field="CustomerID" e-headertext="headerText"></div>
<div e-column e-field="ShipCity"></div>
</div>
</div>
<script>
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope,$rootScope) {
$scope.data = window.gridData;
$scope.headerText = "test header";
});
</script>
样本:http://jsplayground.syncfusion.com/d4nfnple
查询 2:在网格中添加可点击的行
我们建议您使用grid 的rowSelected 事件使行可点击并根据点击执行操作。您也可以启用 CellSelection 并使用 cellSelected 事件。请查看以下API和帮助文档,
行选择:https://help.syncfusion.com/angularjs/grid/selection#row-selection
单元格选择:https://help.syncfusion.com/angularjs/grid/selection#cell-selection
CellSelected 事件:https://help.syncfusion.com/api/js/ejgrid#events:cellselected
RowSelected 事件:https://help.syncfusion.com/api/js/ejgrid#events:rowselected
如需进一步帮助,请回复我们。
此致,
Padmavathy Kamalanathan