表ng

编程入门 行业动态 更新时间:2024-10-26 16:31:00
ng-repeat中的dir-pagination angularjs - 在更改页面时,首先所有行都出现片刻(dir-pagination angularjs in table ng-repeat - while changing page, at first all rows are appearing for a moment)

我是AngularJS的初学者,并在我的表格中应用了dirpagination。 一切正常,只有当我通过点击目录页面按钮导航到我的表格的另一页时,首先表格的高度增加,所有行显示一秒钟,然后显示正确的范围。 我怎样才能避免这种行为? 提前致谢。

这是我的代码:

<table class="table table-hover nbt-table"> <thead> <tr> <th>heading1</th> <th>heading2</th> <th>heading3</th> <th>heading4</th> </tr> </thead> <tbody id="table1"> <tr dir-paginate="value in viralities|itemsPerPage:10" pagination-id="value-paginate"> <td><span ng-bind="value[2]"></span></td> <td><span ng-bind="value[1]"></span></td> <td>{{ value [7] | date : 'dd-MM-yyyy hh:mm'}}</td> <td>{{ value [8] | date : 'dd-MM-yyyy hh:mm'}}</td> </tr> </tbody> </table> <dir-pagination-controls pagination-id="value-paginate" class="pull-right" max-size="10" direction-links="true" boundary-links="true" > </dir-pagination-controls>

I am a beginner in AngularJS and have applied dirpagination in my tables. Everything works fine except that when I navigate to another page of my table by clicking on the dir-pagination page buttons, at first the table's height increases and all the rows are shown for a second, then the correct range is shown. How can I avoid this behaviour? Thanks in advance.

Here is my code:

<table class="table table-hover nbt-table"> <thead> <tr> <th>heading1</th> <th>heading2</th> <th>heading3</th> <th>heading4</th> </tr> </thead> <tbody id="table1"> <tr dir-paginate="value in viralities|itemsPerPage:10" pagination-id="value-paginate"> <td><span ng-bind="value[2]"></span></td> <td><span ng-bind="value[1]"></span></td> <td>{{ value [7] | date : 'dd-MM-yyyy hh:mm'}}</td> <td>{{ value [8] | date : 'dd-MM-yyyy hh:mm'}}</td> </tr> </tbody> </table> <dir-pagination-controls pagination-id="value-paginate" class="pull-right" max-size="10" direction-links="true" boundary-links="true" > </dir-pagination-controls>

最满意答案

通过添加以下CSS解决了这个问题 -

.table > tbody > tr { transition: background 0.0s; }

这阻止了闪烁。 希望这将有助于其他初学者在解决这样的问题。 :)

Solved the issue by adding the following CSS -

.table > tbody > tr { transition: background 0.0s; }

This stopped the flickering. Hopefully this will help other beginners struggling with such problem. :)

更多推荐

本文发布于:2023-07-24 10:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1245043.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ng

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!