save / restore current editor.on event

save / restore current editor.on event

LapointeLapointe Posts: 430Questions: 81Answers: 4
edited January 2021 in Free community support

Hi @all I'm a little bit tired this evening.

What is the way to preserve actual event function and restore it after an action (as button action)

                    extend: 'selected',
                    text:   '->URSSAF',
                    action: function() {
                        // demander la période URSSAF
//                      var rows = table.rows( { selected: true } ).indexes();
                        var OE = editor.on('open');
                        var OC = editor.on('close');
                        editor
                            .hide()
                            .show('recettes.MoisUrssaf')
                            .off('open')
                            .edit(table.rows( { selected: true } ).indexes(), {
                                title: 'Déclaration URSSAF',
                                buttons: [{
                                    label: 'Enregistrer',
                                    className: 'btn-primary',
                                    fn: function () {
                                        this.submit();
                                    }
                                },
                                {
                                    label: 'Annuler',
                                    className: 'btn-primary',
                                    fn: function () {
                                        this.close();
                                    }
                                }]
                            })
                            .set( 'recettes.MoisUrssaf', '2020/12' )
                            .on('close', function () {
                                editor.show()
                                table.buttons( 1, 8 ).disable();
                                editor.on('open',function(){OE});
                                editor.on('close',function(){OC});
                            })
                    }

Thanks

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    You're tired, I'm drunk, we'll make a formidable team! :)

    I'm not too clear on the question (possibly due to previous sentence!), but you may want to look at one(), as this may help structure your code.

    Colin

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @colin
    :D
    Thanks for all sentence.
    B)

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    @colin
    More question... Jameson, Paddy, else ?

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Brewdog beer mostly :) !

This discussion has been closed.