Bootstraptable⽗⼦表默认展开
最近系统⽤了Bootstrap table ,处于慢慢探索中。
后来要求table加载默认展开⼀级数据,如图,摸索了⼀阵⼦,功能是实现了,⼀开始
尝试使⽤table渲染完成事件 onPostBody :function (index, row, $detail) {
InitSubTable(index, row, $detail);
} ,好像没⽤,报错。后来发现有个展开⽅法调⽤ $("#tb_stationInfo").bootstrapTable('expandAllRows'); 但是写在哪?写在table 刷新之后
$("#tb_stationInfo").bootstrapTable('refresh'); $("#tb_stationInfo").bootstrapTable('expandAllRows'); ⽆效。
tabletime想到是不是table 还没渲染完成。后来将展开⽅法封装成⽅法,延时调⽤。function expand ()
{ $("#tb_stationInfo").bootstrapTable('expandAllRows'); };
$("#tb_stationInfo").bootstrapTable('refresh'); setTimeout(expand ,1000); 初步达成,但是万⼀⽹速很卡,
还是会出现问题。
最后想到将展开⽅法写到最初onPostBody 事件中,好像是可以的。
注:这是⾃⼰摸索的,不知道有没有官⽅的使⽤⽅法,有的话,望告知,感激不尽。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论