【发布时间】:2016-12-31 06:41:19
【问题描述】:
我想编辑数据表的行(来自一些rest api调用,数据表中的数据是通过angular js填充的)。
我的问题是我需要在每一行中添加一个输入字段,当我提交时,所有数据都会保存在数据库中。所以你们能帮我添加输入字段吗?当我提交时如何获取所有数据数据表数据并发出 JSON 请求。 enter image description here 请参考图片,我需要在注释列中添加输入字段,当按下保存按钮时,它应该获取数据表中的所有 7 个数据并发出 json 请求。
javascript代码:
vm.dataTableInstance = $('.datatable-basic').DataTable({
data : priorityAttrs,
columns : [
{ data: 'priority', title : 'Priority', width : '10%' },
{ data: 'attrName', title : 'Attribute Name', width: '30%' },
{ data: 'notes', title : 'Notes' },
{ data: null, orderable : false, width:'5%', render : function(data, type, row){
return '<ul class="icons-list"><li class="delete-user text-danger-600" onclick="angular.element(this).scope().deleteAttribute(this, \''+data.attrName+'\')"><a><i class="icon-trash"></i></a></li></ul>';
}}
],
});
【问题讨论】:
标签: angularjs datatable datatables