DataTables Editor: fields.data function, can i determine if I am in a multi-edit?

DataTables Editor: fields.data function, can i determine if I am in a multi-edit?

washuit-iammwashuit-iamm Posts: 133Questions: 55Answers: 2
edited May 2018 in Free community support

I am using the Select2 plugin, I provide it an object and eventually it does sets the _input.val() to an int like Department.Id.

However, during multi-edit when DataTables has that "Multiple Values" dialog, it will circumvent the Select2.get code and fire off the ajax call providing the full object like DepartmentId = { Id: 1, Name: "Human Resources" }. My server breaks expecting an int for DepartmentId.

I realize I can probably access the editor instance to determine this but I want to avoid these global variables as they make refactoring a nightmare.

I see I get data, type, set, and type is "editor", it would be nice to also know if we are dealing with multiple rows. Whats more, in a multi-edit scenario, the function is just called twice. I assume internally DT is using "compare" to figure out if the values are the same.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Can I just confirm I've understood correctly:

    • If you single row edit, it will send the id (1 in the case above) to the server
    • If you multi-row edit, it will send the whole object?

    Thanks,
    Allan

  • washuit-iammwashuit-iamm Posts: 133Questions: 55Answers: 2
    Answer ✓

    Sorry, disregard. I put myself in this spot from modifications I made to the provided Select2 plugin.

This discussion has been closed.