Altered POST data since update to DataTables 1.10.15 and Editor 1.6.2

Altered POST data since update to DataTables 1.10.15 and Editor 1.6.2

edmedm Posts: 19Questions: 6Answers: 0
edited May 2017 in Free community support

After an update, i noticed altered POST data (array _POST) to the server (yes, i purged the browser cache), when i changed one cell content with inline editing:
With DataTables 1.10.13 and Editor 1.6.1:

array(
    ['action'] => 'setEmployeeAssignedTimes'
    ['data'] => array(
        ['jobgroupId-1_employeeToken-SKH'] => array(
            ['sa'] => 1
        )
    )
    ['jobgroup'] => 1
    ['tableWeek'] => 0
    ['showCalendarWeek'] => 18
    ['showYear'] => 2017
)

With DataTables 1.10.15 and Editor 1.6.2:

array(
    ['action'] => 'setEmployeeAssignedTimes'
    ['data'] => array(
        ['jobgroupId-1_employeeToken-SKH'] => array(
            ['employee'] => 'AKH'
            ['sa'] => 1
        )
    )
    ['jobgroup'] => 1
    ['tableWeek'] => 0
    ['showCalendarWeek'] => 18
    ['showYear'] => 2017
)

Look at the waste entry: ['employee'] => 'AKH' (in addition, the value is totally wrong). Where does this waste line comes from?

My config:

    editor_jobgroup_1 = new $.fn.dataTable.Editor ({
        ajax: {
            url: "ajax.php",
            data: {
                "action": "setEmployeeAssignedTimes",
                "jobgroup": "1",
                "tableWeek": "0",
                "showCalendarWeek": showCalendarWeek,
                "showYear": showYear
            }
        },
        table: "#table_weeksGroupsTable1",
        fields: [{
            label: "Kürzel",
            name: "employee",
            type: "select",
            className: "employeeToken",
            options: employeesJobgroup1Diff // Show array[available] - array[already used] employees
            },{
            label: "Mo",
            name: "mo",
            def: "8"
            },{
            label: "Di",
            name: "tu",
            def: "8"
            },{
            label: "Mi",
            name: "we",
            def: "8"
            },{
            label: "Do",
            name: "th",
            def: "8"
            },{
            label: "Fr",
            name: "fr",
            def: "8"
            },{
            label: "Sa",
            name: "sa",
            def: "0"
            }
        ]
    });
    $('#table_weeksGroupsTable1').on ('click', 'tbody td.editable', function (e) {
        editor_jobgroup_1.inline (this);
    });
    table_jobgroup_1 = $("#table_weeksGroupsTable1").DataTable ({
        paging: false,
        ordering: false,
        searching: false,
        info: false,
        dom: "Bfrtip",
        buttons: [
        { extend: "create", editor: editor_jobgroup_1 }
        ],
        columns: [
            { data: "employeeAndWorkload" },
            { data: "mo",
              className: "editable" },
            { data: "tu" },
            { data: "we" },
            { data: "th" },
            { data: "fr" },
            { data: "sa" }
        ]
    });

Eduard

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    Hi Eduard,

    I'm not sure where that is coming from I'm afraid. I don't actually even see a jobgroupId-1_employeeToken-SKH field definition in your code above, so I'm not sure what that field is being included in the submit data at all.

    Could you give me a link to a test case showing the issue please?

    Thanks,
    Allan

  • edmedm Posts: 19Questions: 6Answers: 0

    "jobgroupId-1_employeeToken-SKH" is the table row id (set in php on the server) of the edited row and the editor put them automatically into the _POST array (and this is a good idea). But ['employee'] => 'AKH' is a definitly waste entry.

    Could i send you a link with pm?

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    Yes please - that would be great! Click my name above and then the "Send message" button.

    Thanks,
    Allan

This discussion has been closed.