jQuery UI Widgets Forums Grid Destroyeditor doesn't work properly

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 8 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • maksim_tolo
    Participant

    Hello,

    I’ve found that ‘destroyeditor’ method is never called if we use custom editor for the grid.
    The problem area in the source code is bellow:

    
    _destroyeditors: function() {
                var b = this;
                if (!this.columns.records) {
                    return
                }
                a.each(this.columns.records, function(f, j) {
                    var c = a.trim(this.datafield).split(" ").join("");
                    switch (this.columntype) {
                    case "dropdownlist":
                        var g = b.editors["dropdownlist_" + c];
                        if (g) {
                            g.jqxDropDownList("destroy");
                            b.editors["dropdownlist_" + c] = null
                        }
                        break;
                    case "combobox":
                        var k = b.editors["combobox_" + c];
                        if (k) {
                            k.jqxComboBox("destroy");
                            b.editors["combobox_" + c] = null
                        }
                        break;
                    case "datetimeinput":
                        var d = b.editors["datetimeinput_" + this.datafield];
                        if (d) {
                            d.jqxDateTimeInput("destroy");
                            b.editors["datetimeinput_" + c] = null
                        }
                        break;
                    case "numberinput":
                        var e = b.editors["numberinput_" + c];
                        if (e) {
                            e.jqxNumberInput("destroy");
                            b.editors["numberinput_" + c] = null
                        }
                        break;
                    case "custom":
                    case "template":
                        if (b.destroyeditor) {
                            if (b.editors["templateeditor_" + c]) {
                                b.destroyeditor(b.editors["templateeditor_" + c]);
                                b.editors["templateeditor_" + c] = null
                            }
                        }
                        if (b.destroyeditor) {
                            var m = b.getrows.length();
                            for (var l = 0; l < m; l++) {
                                if (b.editors["customeditor_" + c + "_" + l]) {
                                    b.destroyeditor(b.editors["customeditor_" + c + "_" + l], l);
                                    b.editors["customeditor_" + c + "_" + l] = null
                                }
                            }
                        }
                        break;
                    case "textbox":
                    default:
                        var h = b.editors["textboxeditor_" + c];
                        if (h) {
                            b.removeHandler(h, "keydown");
                            b.editors["textbox_" + c] = null
                        }
                        break
                    }
                });
                b.editors = new Array()
            }
    

    As you can see ‘destroyeditor’ function called only if ‘b.destroyeditor’ is truthy for the ‘custom’ and ‘template’ columntype. But in this case variable ‘b’ is the reference to the grid instance. I think you should call ‘j.destroyeditor’ instead ‘b.destroyeditor’ due to ‘j’ is the reference to the column config.

    The bug reproduced in jQWidgets v4.1.2

    Destroyeditor doesn't work properly #85595

    Dimitar
    Participant

    Hello maksim_tolo,

    Thank you for your feedback. We confirm this issue and have created a work item about it. Please, however, abstain from posting unminified parts of the jQWidgets source code publicly, as this violates the jQWidgets end-user license agreement.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.