Bootstrap表更新内容不起作用 [英] Bootstrap Table update content not working

查看:88
本文介绍了Bootstrap表更新内容不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wenzhinxin的引导程序表但无法更新表格内容。

I'm using wenzhinxin's bootstrap table but having trouble updating the table content.

我有两张桌子。一个显示所有员工,另一个显示所提到的第一个表中所选员工的报告。

I have two tables. One displaying all employees and the other displaying reports of the selected employee from the first table mentioned.

当点击第一个表中的员工时,我调用此代码来更新数据我的第二张桌子:

when clicking an employee in the first table i call this code to update the data of my second table:

$('#report-table').bootstrapTable('showLoading');

$.ajax({
 type : "POST",
 url : "getReportsForEmployee.php",
 data : "id=" + row['id'],
 dataType:"json",
 success : function(data) 
 {
  $('#report-table').bootstrapTable('hideLoading');
  $('#notification').hide();
  $('#report-table').bootstrapTable({
   data: data
  });
 }

我第一次点击员工时,报告会正确加载到我的第二个表中,但是第二次我点击一个员工(或第三次等),表格不再更新。我检查了谷歌浏览器中的网络流量,以验证我收到了正确的回复,我可以确认响应因员工而异点击。表格似乎只是在我第一次设置数据属性时更新其内容。

The first time i click an employee, the reports are loaded correctly into my second table, but the second time i click an employee (or third etc) the table is not updated anymore. I checked my network traffic in google chrome to verify that i receive the correct response which i do and i can confirm that the response varies depending on which employee i click. The table seems only to update its content the first time i set the data property.

推荐答案

想我必须更新这个问题,因为我很久以前就找到了答案。

Figured i had to update this question, since i found the answer long time ago.

Wh我失踪的是在设置数据属性时调用加载函数:

What i was missing was calling the load function when the data property was set:

$('#report-table').bootstrapTable('load', data);

这篇关于Bootstrap表更新内容不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆