recharge change event in a select box when the form editor opens

recharge change event in a select box when the form editor opens

DesarrolloPRECDesarrolloPREC Posts: 34Questions: 4Answers: 0

Hello

I'm trying to implement a change event on selectbox. The code is as follows: continent

    editor = new $ .fn.dataTable.Editor ({
         ...
        fields: [
            {
                label: "Continent",
                name: "acId.acContinent.dpCode"
                type: "select"
                ipOpts: getContinent (),
                def: 184
            },
        ...
    });

// Attaching event
    $ ('Select' editor.node ('acId.acContinent.dpCode')). On ('change', function () {
        console.log ("Continent" + ($ (this) .val ()));
    });

table = $ ('# table'). DataTable ({
      ...
});

When first loaded no problem, but when I press the button: create or update the editor to open the form, the event is called multiple times.

He had a role to recharge other selectbox, but I was staying in a repeat loop six times. And when they reopened, he called again but this time the calls were duplicated and so on.

The drawback happens when I try to open the form window in events: create or edit

In the console I have put a siguimiento:

Continent: 184
Continent: 184
Continent: 184
Continent: 184
Continent: 184
Continent: 184

The change event has been called six times.

Maybe there is some reference that I've forgotten when I place the event?

Thanks for your help

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    edited December 2015 Answer ✓

    Hi,

    I'm afraid that this is a bug in Editor 1.5.3 which results in the change event being triggered for every option in this select list. This suggests that you have six options in this list.

    The fix has been committed and will be released in Editor 1.5.4 which I expect to ship later today. If you need the fix more urgently than that, could you drop me a PM with your e-mail address and I'll e-mail the updated script through to you.

    Regards,
    Allan

This discussion has been closed.