Inline editing
Inline editing
kscdev
Posts: 2Questions: 2Answers: 0
Very new to the grid - is there a way to allow editing in the grid itself? Inherited a program from someone who left the company. My code - apologies for the length - is as follows:
$(document).ready(function () { $("#@string.Format("{0}_List", modelName)").dataTable({ "sDom": '<"H"lr<"export_info"T>f>t<"F"ip>', "oTableTools": { "sSwfPath": "/Content/Themes/base/DataTables/swf/copy_csv_xls_pdf.swf", "aButtons": [ { "sExtends": "xls", "sToolTip": "Save as Excel", "mColumns": [1, 2, 3, 4] @* NOTE: set the column indexes of the columns you wish to be included in the exported file *@ }, { "sExtends": "pdf", "sToolTip": "Save as PDF", "mColumns": [1, 2, 3, 4], @* NOTE: set the column indexes of the columns you wish to be included in the exported file *@ "sPdfOrientation": "landscape", "sPdfMessage": "Exported on @System.DateTime.Today.ToShortDateString()" }, ] }, "inline": true, "bPaginate": true, "sPaginationType": "full_numbers", "bStateSave": true, "iCookieDuration": 1209600, "aLengthMenu": [ [10, 20, 50, -1], [10, 20, 50, "All"] ], "iDisplayLength": 10, "bJQueryUI": true, "aoColumnDefs": [ { bSortable: false, aTargets: [0] } ] }).columnFilter({ aoColumns: [null, { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } , { type: "text" } ] }); // Refresh button $("#@string.Format("btnTo{0}_refresh", modelName)").click(function () { location.reload(true); }); }); // Delete confirmation $(function () { $(".deleteButton").click(function () { // get the ID of the record stored in the data-id attribute var id = $(this).data("id"); alertify.set({ labels: { ok: "Yes, Delete It", cancel: "No, Don't Delete" } }); alertify.confirm('Are you sure you wish to delete this record?
This CANNOT BE UNDONE!
', function (clickedYes) {
if (clickedYes) {
$.ajax({
type: "POST",
url: "/@ControllerName/Delete/",
data: { id: id, __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val() },
success: function (response) {
alertify.success("Successfully Deleted");
window.location = "/@modelName";
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.responseText !== "") {
alertify.alert(xhr.responseText);
alertify.error(xhr.responseText);
}
}
});
}
});
// IMPORTANT: we need to reset the Ok and Cancel button labels back to the defaults
alertify.set({
labels: {
ok: "Ok",
cancel: "Cancel"
}
});
});
});
THANK you very much for any assistance.
This discussion has been closed.