Is there currently away to submit edits for more than one row a a time?
Currently no. This is something that I'm looking into for a future version of Editor.
Allan
I figured out an in-the-mean-time work around for anyone who wants it...
Column setup:
"sName": "InactiveContact", "mData": "InactiveContact", className: "editable InactiveContact", "render": function (data, type, row) { return '<span class="InactiveContact">' + data + '</span>'; }
My on click:
$('#contactTable').on('click', 'tbody td.editable, td.editable span', function (e) { if ($(this).find("span").length >= 1) { var id = $(this).closest('tr').attr('id'); var field = $(this).find("span").attr('class');
editor.inline(this, { buttons: { label: '>', fn: function () {saveThis(id, field);} } }); } });
My "save" function:
function saveThis(id, field) { var val; if ($("#" + id + " td." + field + " select")) { val = $("#" + id + " td." + field + " select").val() } else if ($("#" + id + " td." + field + " input")) { val = $("#" + id + " td." + field + " input").val() } editor.close(); $("#" + id + " td." + field).html('<span class="' + field + '">' + val + '</span>') $("#" + id + " td." + field).addClass("edit") $("#" + id).addClass("updated") }
And then... I have a button that runs this when I'm done and want to save:
function createJSON() { jsonObj = []; $("tr.updated").each(function () { var id = $(this).attr('id');
item = {} item["id"] = id; $("#" + id + " .edit").each(function () { var val = $(this).find('span').text(); var field = $(this).find('span').attr('class'); item[field] = val; }); jsonObj.push(item); });
}
After I make the object, I send to s In this, I'm only sending back updated fields.
wishes for manual code tagging lol
Answers
Currently no. This is something that I'm looking into for a future version of Editor.
Allan
I figured out an in-the-mean-time work around for anyone who wants it...
Column setup:
"sName": "InactiveContact",
"mData": "InactiveContact",
className: "editable InactiveContact",
"render": function (data, type, row) {
return '<span class="InactiveContact">' + data + '</span>';
}
My on click:
$('#contactTable').on('click', 'tbody td.editable, td.editable span', function (e) {
if ($(this).find("span").length >= 1) {
var id = $(this).closest('tr').attr('id');
var field = $(this).find("span").attr('class');
My "save" function:
function saveThis(id, field) {
var val;
if ($("#" + id + " td." + field + " select")) {
val = $("#" + id + " td." + field + " select").val()
} else if ($("#" + id + " td." + field + " input")) {
val = $("#" + id + " td." + field + " input").val()
}
editor.close();
$("#" + id + " td." + field).html('<span class="' + field + '">' + val + '</span>')
$("#" + id + " td." + field).addClass("edit")
$("#" + id).addClass("updated")
}
And then... I have a button that runs this when I'm done and want to save:
function createJSON() {
jsonObj = [];
$("tr.updated").each(function () {
var id = $(this).attr('id');
}
After I make the object, I send to s
In this, I'm only sending back updated fields.
wishes for manual code tagging lol