我datatable
在项目中使用了以下内容。我已成功将所有数据填充到中datatable
。
我只需要将行选择中的特定行数据填充到同一页面上找到的文本字段中,并更新这些数据,然后将其保存在数据库中。
使用的数据表链接:https : //datatables.net/examples/api/select_single_row.html
jsfiddle:https ://jsfiddle.net/o92g9goL/2/
更新:
var name = $(this).children('td[name="name"]').text();
var position = $(this).children('td[name="position"]').text();
var office = $(this).children('td[name="office"]').text();
var age = $(this).children('td[name="age"]').text();
var startdate = $(this).children('td[name="startdate"]').text();
var salary = $(this).children('td[name="salary"]').text();
var nameInp = $('input[name="name"]');
var positionInp = $('input[name="position"]');
var officeInp = $('input[name="office"]');
var ageInp = $('input[name="age"]');
var startdateInp = $('input[name="start"]');
var salaryInp = $('input[name="salary"]');
$(nameInp).attr('value',name);
$(positionInp).attr('value',position);
$(officeInp).attr('value',office);
$(ageInp).attr('value',age);
$(startdateInp).attr('value',startdate);
$(salaryInp).attr('value',salary);
这就是您想要的,应该Simple inline editing
从中使用dataTables.editor.min.js
:
$('#example').on( 'click', 'tbody td:not(:first-child)', function (e) {
editor.inline( this );
} );
并检查一下:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句