Checkbox data getting posted even if that is not being updated as part of Inline Editing

Checkbox data getting posted even if that is not being updated as part of Inline Editing

nishantlakhlaninishantlakhlani Posts: 1Questions: 0Answers: 0
edited February 2016 in Free community support

The below code snippet is used in my partial view of ASP.NET MVC project which is implemented for cell based i.e. onBlur submit.

The issue is that even if any other column / cell is updated, the data for "Impact Type" gets posted which I do not want.

For e.g. if we click on "Issue Details" and then leave the cell with updating the data / without updating the data, the data for Impact type gets posted which is not required. (Note: This happens only when I specify type = "checkbox" else it works fine. Can anyone correct / suggest any solution

The data returned by "/Issue/GetIssues" has options:optImpactTypes & optStatus

var editor = new $.fn.dataTable.Editor({
    ajax: "/Issue/PostIssueDetails",
    table: "#tblIssue",
    idSrc: 'Issue.IssueId',
    fields: [
                { label: "ID", type: "readonly", name: "Issue.IssueNumber" },
                { label: "Status", name: "optStatus", type: "select" },
    { label: "Issue Details", name: "Issue.IssueDetails", type: "textarea" },
                { label: "Impact Type", name: "optImpactTypes", type: "checkbox", multiple: true }
    ]
});

var table = $('#tblIssue').DataTable({
            dom: "Bfrtip",
            ajax: "/Issue/GetIssues",
            deferRender: false,
            columns: [
                        { data: "Issue.IssueNumber", className: 'ReadOnlyColumns' },                      
                        { data: "Issue.Status", editField: 'optStatus', type: "select", className: "editable" },
            { data: "Issue.IssueDetails", className: "editable" },
                        {
                            data: "Issue.IssueImpactTypes", editField: 'optImpactTypes', type: "select", className: "editable",
                            "render": function (data, type, full, meta) {
                                var impactTypeDesc = "";
                                $.each(full.Issue.IssueImpactTypes, function (itemNo, dataValue) {
                                    if (dataValue.Description != "" && dataValue.Description != undefined) {
                                        impactTypeDesc += dataValue.Description + ", ";
                                    }
                                });
                                return impactTypeDesc.slice(0, -2);
                            }
                        }                      
            ],
            "columnDefs": [
               { "className": "text-center", "targets": "_all" },
               { "orderable": false, "targets": [0] }
            ],
            "order": [0, 'desc'],
            "searching": true,
            "paging": true,
            "bInfo": true,
            "scrollX": true,
            "bAutoWidth": true,
            "processing": false,
            "bDeferRender": true,
            "oLanguage": {
                "sSearch": "Search : "
            },
            "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                $(nRow).addClass('gvRowLeftAlligned');
                return nRow;
            }
    });

            // Inline editing on click
            $('#tblIssue').on('click', 'tbody td.editable', function (e) {
                editor.inline(this, {
                    onBlur: 'submit'
                });
            });
This discussion has been closed.