UI-GRID 可扩展网格.以编程方式展开一行 [英] UI-GRID Expandable Grid. Programatically expand one row
问题描述
我想隐藏最左侧栏中的 + 图标并添加另一个图标.
I want to hide the + icon in the far left column and add another icon.
当用户单击新图标时,我想以编程方式展开该特定行.
When the user clicks the new Icon I want to programatically expand that specific row.
我看到有 gridApi.expandable.expandAllRows();
I see there is gridApi.expandable.expandAllRows();
有没有办法只展开一行?
Is there a way to expand just one row?
推荐答案
如果您只想将默认加号图标更改为其他图标,您可以简单地覆盖 expandableRowHeader 的模板.
If all you want is to change the default plus icon to a different icon, you can simply override the template for the expandableRowHeader.
$templateCache.put('ui-grid/expandableRowHeader',
"<div class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell"><div class="ui-grid-cell-contents"><i ng-class="{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }" ng-click="grid.api.expandable.toggleRowExpansion(row.entity)"></i></div></div>"
);
您可以更改 ng-class="{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }"
并将它们更改为您选择的不同图标.
You can change the ng-class="{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }"
and change them to a different icon of your choice.
这篇关于UI-GRID 可扩展网格.以编程方式展开一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!