Jquery dataTable可编辑单元格 [英] Jquery dataTable Editable Cell
问题描述
我放弃了,因为我在过去4个小时里一直在搞乱,我只是没有到任何地方。当使用这里发现的jquery datatable时。 http://datatables.net/examples/api/editable.html (似乎是非常流行的插件)除了可编辑的单元格部分,我可以得到很多我想要工作的所有内容。我有这个顺序的文件
I give up as I have been messing around with this for the past 4 hours and I am just not getting anywhere. When using the jquery datatable found here. http://datatables.net/examples/api/editable.html (seems like a very popular plug in) I can get pretty much everything I want to work except the editable cell part. I have my file in this order
<script src="JS/jquery.js"></script>
<script src="JS/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="JS/jquery.jeditable.js"></script>
<script src="JS/jquery.validate.js"></script>
<script src="JS/ColReorder.min.js"></script>
<link href="JS/css/jquery.dataTables.css" rel="stylesheet" />
然后我有这个脚本来初始化表。
and then I have this script to get the table initialized.
function formattable(thistable) {
//alert(thistable + " from format table")
// $(document).ready(function () {
// ADPControlProcessor_Table1
//$("#ADPControlProcessor_GridView1").dataTable();
var oTable = $("#ADPControlProcessor_GridView1").dataTable({
//"bFilter": true,
"sScrollY": "200px",
"bPaginate": false,
"bAutoWidth": false,
"sDom": 'Rlfrtip'
//});
//alert("running");
});
//var oTable = $('#example').dataTable();
/* Apply the jEditable handlers to the table */
$('td', oTable.fnGetNodes()).editable('../examples_support/editable_ajax.php', {
"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"
});
我不知道要尝试什么。任何人都可以指向正确的方向。
I dont know what elese to try. can anyone point me in the right direction.
推荐答案
你没有初始化正确尝试这个
you are not initialize correct Try this one
$(document).ready(function() {
/* Init DataTables */
var oTable = $('#example').dataTable();
/* Apply the jEditable handlers to the table */
$('td', oTable.fnGetNodes()).editable( '../examples_support/editable_ajax.php', {
"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"
} );
} );
这里是现场示例点击这里
这篇关于Jquery dataTable可编辑单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!