使用Jquery datatable jeditable不必要的字段URL [英] Using Jquery datatable jeditable without mandatory field URL
问题描述
如何使用 jquery.datatable
和没有url的 jeditable
插件。我只想编辑功能而不保存到服务器。这是我试过的:
$('td',oTable.fnGetNodes())。editable(function ,设置){
console.log(this);
console.log(value);
console.log(settings);
return(value);},{
类型:'textarea',
提交:'OK',
回调:function(sValue,y){
var aPos = oTable.fnGetPosition(this);
oTable.fnUpdate(sValue,aPos [0],aPos [1]);
},
});
我拿了 datatables.net上的Jeditable(或jEditable)示例,并根据该问题中提供的Golden Bird进行了修改, 日志文件对此主题的看法。要进行测试,您可以编辑网格中的任何值,排序一次应用,所有其他与数据表相关的功能也同样适用(例如,搜索新值)。
$(document).ready(function(){
var oTable = $('table')。dataTable();
var theCallback = function(v,s){
//使用新值执行某些操作
return v;
};
$(oTable).find('td')。可编辑(theCallback,{
回调: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选择,
submit:OK,
style:{height:100%,width:100%}
});
});
How can you use jquery.datatable
and the jeditable
plugin without a url. I just want edit functionality without saving to the server. This is what I've tried:
$('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] );
},
});
I took the Jeditable (or jEditable) example on datatables.net and modified it based on what Golden Bird provided in the question and what the Jeditable docs say on this topic. To test, you may edit any value in the grid, the sorting applies at once and everything else datatables-related works as well (e.g. searching for the new value).
$(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%"}
});
});
这篇关于使用Jquery datatable jeditable不必要的字段URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!