editable.js 基于jquery的表格的编辑插件

2020-05-18 09:00:27易采站长站整理

return true;
},
editcss: “edit”,
delcss: “del”,
onokcss: “onok”,
canclcss: “cancl”
};
})(jQuery);


下面来看下插件的效果


 1.数据表格




2.添加编辑功能

$(function () {
$(“table”).editable({
head: true, //有表头
noeditcol: [0], //第一列不可编辑
editcol: [{ colindex: 1 }, { colindex: 2, edittype: 2, ctrid: “sel”}], //配置表格的编辑列 ctrid:为关联的dom元素id
onok: function () {
return false; //返回false表示失败,dom元素不会有变化
},
ondel: function () {
return true; //返回false表示成功,dom元素相应有变化
}
});
});


3.添加编辑后的效果



注:另外可以配置编辑功能中的几个按钮样式,详见代码咯 ;)
文件源码:editable.rar