如何将新添加或删除行添加到bootstrap数据表中 [英] How to add newly added or remove row into bootstrap datatable

查看:114
本文介绍了如何将新添加或删除行添加到bootstrap数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用json绑定我的表,就像CRUD操作一样,我在其上实现了bootstrap,使用转发器控制将数据显示到表中,并使用搜索对分页进行排序。

I am using json to bind my table like CRUD operation also I implemented bootstrap on it to show data into table using repeater control and sorting paging with searching.

每件事情都运转正常,但我在TR中添加新记录或从表中删除任何记录,因此数据不会反映到bootstrap表中

every thing is working fine but as I add new record into TR or delete any record from table so data is not reflected into table of bootstrap

我需要刷新我的页面以查看数据...(数据插入到列表中我已经检查了这个)

I need to refresh my page to see that data …(data is inserting well into list I have checked this )

让我知道如何将我的tr添加到bootstrap数据表我返回列表(类)如response.d [0] .news

let me know how can I add my tr to bootstrap datatable I am returning list(class) like response.d[0].news

,response.d [0]这样的新闻名称将td填充到tr ..

,response.d[0]news name like this to populate td into tr..

谢谢

推荐答案

请添加一个JavaScript Timer来刷新此DataTable而不重新加载页面,以便新添加,删除的行将及时呈现:

Please add a JavaScript Timer to refresh this DataTable without page reload so that newly added, deleted rows will render in time:

var table =


('#example')。DataTable({
ajax:" data.json"
});

setInterval(function(){
table.ajax.reload();
},1000);
('#example').DataTable( { ajax: "data.json" } ); setInterval( function () { table.ajax.reload(); }, 1000);

参考:

DataTable ajax reload

谢谢

最好的问候


这篇关于如何将新添加或删除行添加到bootstrap数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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