2016-12-31 79 views
0

我想编辑数据表的行(这是来自一些其余的api调用,数据表中的数据通过角度js填充)。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>'; 
      }} 
], 
}); 

回答

0

您可以使用角Xeditable用于添加数据表。请参考this文件。

  1. 安装xeditable

    亭子安装角xeditable

  2. 包括角xeditable到项目

  • 将“xeditable”添加到依赖项

    var app = angular.module(“app”,[“xeditable”]);