Gol*_*ird 5 javascript jquery jeditable datatables
如何jquery.datatable在jeditable没有网址的情况下使用和插件.我只想要编辑功能而不保存到服务器.这就是我尝试过的:
$('td', oTable.fnGetNodes()).editable(function(value, settings) {
console.log(this);
console.log(value);
console.log(settings);
return(value);}, {
type : 'textarea',
submit : 'OK',
callback: function( sValue, y ) {
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
});
Run Code Online (Sandbox Code Playgroud)
我在datatables.net上采用了Jeditable(或jEditable)示例,并根据问题中提供的Golden Bird以及Jeditable文档对此主题的说法对其进行了修改.要进行测试,您可以编辑网格中的任何值,排序立即应用,其他所有与数据表相关的工作也可以(例如,搜索新值).
$(document).ready(function() {
var oTable = $('table').dataTable();
var theCallback = function(v, s) {
// Do something with the new value
return v;
};
$(oTable).find('td').editable(theCallback, {
"callback": function(sValue, y) {
var aPos = oTable.fnGetPosition(this);
oTable.fnUpdate(sValue, aPos[0], aPos[1]);
},
"data": "{'0':'0%', '.1':'10%', '.15': '15%', '.2': '20%', 'selected':'0'}",
"type" : "select",
"submit" : "OK",
"style": {"height": "100%","width": "100%"}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2373 次 |
| 最近记录: |