如何使expandale在UI格表只有一行 [英] How to make expandale only one row in ui-grid table

查看:262
本文介绍了如何使expandale在UI格表只有一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的UI格在我的项目。

I use ui-grid in my project.

我使用扩展功能在用户界面电网。

I am using expandable feature in ui-grid.

我需要扩展的只有一排。

I need to make expandable only one row.

例如,如果我点击的第5行+号,然后我点击就行号2排5号已经被关闭和行号2,必须扩大+号。

For example, if I click on '+' sign on row number 5 and then I click on '+' sign on row number 2 the row number 5 have to be closed and row number 2 have to be expanded.

任何想法,我怎么能实现UI网这种行为?

Any idea how can I implement this behaviour in ui-grid?

推荐答案

您应使用可扩张特征以下API:

You should use the following api from the expandable feature:


  • rowExpandedStateChanged

  • rowExpandedStateChanged

这是每当膨胀状态被改变,并且可以用于拦截用户扩大另一行引发的事件。

This is an event raised whenever the expanded state is changed and can be used to intercept the user expanding another row.


  • toggleR​​owExpansion(rowEntity)

  • toggleRowExpansion(rowEntity)

这可以在收到该事件关闭任何其他扩展行使用。

This can be used upon receiving the event to close any other expanded row.

在您的code,你应该添加内该行的 gridOptions.onRegisterApi

Inside your code you should add this row inside of your gridOptions.onRegisterApi

gridApi.expandable.on.rowExpandedStateChanged(scope,function(row){})

在哪里的功能是您滚动网格中的所有行,检查他们是否扩大或不检查一个自定义函数 row.isExpanded 并关闭所有的扩展行(但一用户只需扩展,很明显)。

Where function is a custom function where you scroll all the rows in the grid, check whether they are expanded or not by checking row.isExpanded and close every expanded row (but the one the user just expanded, obviously).

只是一个提醒,作为球队的网站上指出,提防的扩张特征仍处于alpha阶段。

Just a reminder, as the team stated on the website, beware that the expandable feature is still in a alpha stage.

这篇关于如何使expandale在UI格表只有一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆