Footable and capturing the expand row event

南笙酒味 提交于 2019-12-04 22:02:23

You can bind functions to certain footable events:

$('.footable').footable().bind({
    'footable_row_collapsed' : function(e) {
        //Your code when a row is collapsed
    },

    'footable_row_expanded' : function(e) {
        //Your code when a row is expanded                  
    },
});

Here is the documentation about footable events interception (http://fooplugins.com/footable/demos/event-interception.htm#docs).

Here is the list of footable events (http://fooplugins.com/footable/demos/events.htm#docs).

Lack of footable documentation will end up being the end of this product.

Documentation is now listed here: https://fooplugins.github.io/FooTable/docs/jsdocs/FooTable.html

The expand event seems to be the most used. Here is an example of swapping out the detail-row using AJAX:

$(".footable").on("expand.ft.row", function (e, ft, row) {
  var EmployeeId = row.value.EmployeeId //Access data from a specific column
  var RowElement = $(row.$el) //This is the underlying DOM element for the row (<tr>...</tr>)
  if (EmployeeId) {
    $.get({
      url: "http://ajax-provider/" + EmployeeId,
      dataType: "html",
      success: function (data) {
        var DetailRow = RowElement.next(".footable-detail-row")
        DetailRow.children("td").html(data)
      }
    })
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!