Add fields to DataTables Editor removal screen

Add fields to DataTables Editor removal screen

MvdGMvdG Posts: 2Questions: 1Answers: 0
edited May 2016 in Free community support

Hi,

Is it possible to add fields to the Editor removal screen above (or below) the delete confirmation? I would like to offer a reason for deletion to my customers. The reason of deletion should be posted to the backend (for e-mailing and storing in DB).

So far I tried this:

editor.on('initRemove', function (e, node, data) {
            editor.add({
                    label: "Reason",
                    name: "REASON",
                    type: "select",
                    options: [
                        {label: "reason1", value: 1},
                        {label: "reason2", value: 2},
                        {label: "reason3", value: 3},
                        {label: "reason4", value: 4}
                    ]
                });
        });

The code works when I change the initRemove to initEdit.

Kind regards,

Mauro

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin
    Answer ✓

    Currently no - the Editor remove view will not display any fields. To be honest, this is the first time that I can recall being asked about this and with a really good reason to add it. I completely see your point.

    When you do the delete, are you actually just marking the row in the database as deleted and adding the reason? If so, then it might be appropriate to actually use an edit button (possibly with a second, simplified, Editor instance) which will set the delete flag and also the reason.

    Allan

  • MvdGMvdG Posts: 2Questions: 1Answers: 0

    Hi Allan,

    Thanks for you reply!

    I never thought about creating another edit screen which sets a flag and reason, I will try this right away.

    Thanks!

This discussion has been closed.