簡體   English   中英

添加新行后無法“刷新”filagroup tablesaw響應表

[英]can't “refresh” filamentgroup tablesaw responsive table after adding new rows

我正在使用AngularJS Utils分頁指令和filamentgroup tablesaw響應表庫的組合來嘗試獲得響應(通過向右滑動),分頁表。

一旦我填充了表格,我就會從另一個名為responsive-table的指令中調用tablesaw“refresh”事件,它使表格完全響應,並且對全世界都很好。

 $("tableselector").table("refresh") 

但是,當我然后更改頁面(因此表中的行更改)時,表停止響應(如果您檢查HTML,我可以看到新行在'tr'元素上沒有相關的tablesaw類,而'th'元素仍然存在)。

我有點期待這個,並試圖再次調用刷新事件,但這不起作用,所以我嘗試了破壞事件,這似乎也沒有工作!

以下是我的HTML供參考。

 <table class="table table--stripe" data-mode="swipe" responsive-table> <thead> <tr> <th>Email</th> <th>Name</th> <th>User role</th> <th></th> </tr> </thead> <tbody> <tr dir-paginate="user in Model.Users | itemsPerPage:Model.PageSize" current-page="Model.CurrentPage"> <td>{{user.Email}}</td> <td>{{user.DisplayName}}</td> <td>{{user.Role}}</td> <td>{{user.Telephone}}</td> </tr> </tbody> </table> 

我已經發現大致的桌面代碼出現“錯誤”的地方(雖然我懷疑這只是我缺乏理解)

  $.fn[pluginName] = function () { return this.each(function () { var $t = $(this); if ($t.data(pluginName)) { return; } var table = new Table(this); $t.data(pluginName, table); }); }; 

經過大量的tablesaw代碼后,我發現在插入新行並調用refresh,destroy甚至create事件后,上面的代碼總是通過return語句退出。

有沒有其他人有這些問題或知道我是如何錯誤地使用任一庫來刷新/銷毀/重新創建響應表?

所以我通過https://github.com/zachleat在GitHub上指出了正確的方向。

在用戶單擊以移動到下一個分頁頁面后,我不得不稍微更改刷新表的代碼行。

$('#mytable').table().data("table").refresh()

只是因為在調用refresh()之前加載了tbody> tr> td。 這是偶然的。 refresh func不會調用snip $ cells.wrapInner(“”); $ cells.prepend(“”+ html +“”);“

您可以更改源代碼。 使用刷新事件的init事件instand。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM