如何在已经存在的记录的json datatable之上添加一行 [英] how to add a new row in top of a json datatable with already existing records

查看:156
本文介绍了如何在已经存在的记录的json datatable之上添加一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在datatable的顶部添加一行,显示列amount的总和。我使用json datatable(jquery plugin)列表显示datatable。我如何将这行添加到现有行的datatable之上?

解决方案

我认为这段代码可以帮助你

  var json ='{uid:user123,firstName:User,lastName:Theuser}' ; 
userTable.fnAddData(json);

请参阅以下链接



<一个href =http://datatables.net/forums/discussion/8682/adding-a-new-row-using-pojo-or-json-not-working =nofollow> JsonDatatable





在从表中获取数据的同时也将其作为第一行


I am trying to add a row in top of a datatable which shows sum of a column "amount".I am using json datatable(jquery plugin) list to display datatable. How can i add this row in top of datatable with existing rows?

解决方案

I think this code will help you

var json = '{ "uid": "user123", "firstName": "User", "lastName": "Theuser" }';
userTable.fnAddData(json);

Please refer the below link

JsonDatatable

Or

At the time of fetching data from table take sum also and make it as first row

这篇关于如何在已经存在的记录的json datatable之上添加一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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