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. .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.
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.
Share Improve this question edited Jul 4, 2013 at 7:24 Toby Allen 11.2k12 gold badges79 silver badges131 bronze badges asked Jul 4, 2013 at 6:38 MiguelMiguel 2,0795 gold badges29 silver badges53 bronze badges 2- i updated the post with the solution . – Miguel Commented Jul 4, 2013 at 7:21
- hi miguel, you should post your solution as an answer not an update to your question. – Toby Allen Commented Jul 4, 2013 at 7:25
2 Answers
Reset to default 11Instead of paying for the editable plugin I built my own which you're free to use. The repo is here: DataTables CellEdit Plugin
The basic initialization is quick and easy:
oTable.MakeCellsEditable({
"onUpdate": myCallbackFunction
});
myCallbackFunction = function (updatedCell, updatedRow) {
console.log("The new value for the cell is: " + updatedCell.data());
}
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"
} );
} );
here is live example click here