最近系统用了Bootstrap table ,处于慢慢探索中。bootstrap
后来要求table加载默认展开一级数据,如图 ,摸索了一阵子,功能是实现了,一开始blog
尝试使用table渲染完成事件 onPostBody :function (index, row, $detail) {
InitSubTable(index, row, $detail);
} ,好像没用,报错。 后来发现有个展开方法调用 $("#tb_stationInfo").bootstrapTable('expandAllRows'); 可是写在哪? 写在table 刷新以后事件
$("#tb_stationInfo").bootstrapTable('refresh'); $("#tb_stationInfo").bootstrapTable('expandAllRows'); 无效。it
想到是否是table 还没渲染完成。后来将展开方法封装成方法,延时调用。function expand (){ $("#tb_stationInfo").bootstrapTable('expandAllRows'); };io
$("#tb_stationInfo").bootstrapTable('refresh'); setTimeout(expand ,1000); 初步达成,可是万一网速很卡,仍是会出现问题。table
最后想到将展开方法写到最初onPostBody 事件中,好像是能够的。function
注:这是本身摸索的,不知道有没有官方的使用方法,有的话,望告知,感激涕零。渲染