我开始使用jQuery Datatables Plugin,当用户点击显示文本时,将表格/单元格从显示文本更改为文本框。现在,我的下一步是在用户编辑单元格中的值后将此信息保存在数据库记录中。
这是我的可编辑表格的代码。
/* Init DataTables */
var oTable = $('#tblAmount').dataTable({
"bPaginate": false,
"bFilter" : false,
"bInfo" : false
});
/* Apply the jEditable handlers to the table */
oTable.$('td').editable( 'ajaxUpdateAmount.asp', {
"callback": function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
return {
"row_id": this.parentNode.getAttribute('id'),
"column": oTable.fnGetPosition( this )[2]
};
},
"height": "14px",
"width": "100%"
} );
下表如下:
<table cellpadding="0" cellspacing="0" border="0" class="display" id="tblAmount">
<thead>
<tr>
<th>RecordID</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>123</td>
<td>$1,000</td>
</tr>
</tbody>
</table>
关于:
的任何建议1)如何将recordID发送到ajax页面?
2)如何在单元格中更改值后实际查看ajax页面更新?也许在DIV中显示什么?
如果可能,请提供示例代码。
谢谢,