bug report: datatable subview is not destroyed when remove datatable view

Hi
I have a datatable subview with inside some fields (combo, text ecc) with fixed id, because the fields must interact with each other (for example I have combos that depend on what has been selected in other previous combos)
when I remove the datatable and then add it again, the system fails as a result of duplicate id fields

Comments

  • workaround

    webix.attachEvent("onDataTable", function (table, config) {
            table.eachColumn(id => {
                var col = table.getColumnConfig(id);
                if (col.suggest && typeof col.suggest == "object") {
                    col.$destroySuggest = true
                }
            })
            table.attachEvent("onDestruct", function () {
                table.eachColumn(id => {
                    var col = table.getColumnConfig(id);
                    if (col.$destroySuggest) {
                        var suggest = $$(col.suggest);
                        suggest && suggest.destructor();
                    }
                })
                table.config.subview && table.eachRow(row => {
                    var subView = table.getSubView(row)
                    subView && subView.destructor()
                })
            })
    })
    

    suggests as object are not destructed as well.
    so there is a workaround for them too.

  • Hello,

    I can confirm the issue. We will fix it in the next version 6.2
    Thank you for the report!

  • edited December 2018

    @davideS4bt Could you please check the following info?

    a datatable subview with inside some fields (combo, text ecc) with fixed id

    In such config the system will show the "non unique id" error already when any subsequent subview is opened, because the same configuration is used. So you needn't destroy anything.

    Try this snippet locally with the debug version and open several subviews to see the error: https://snippet.webix.com/sfiq2pmv

    So while we can fix a bug with datatable destruction and subviews (and we will), fixed ids in subview configuration are not correct. If you still need to tune some interaction between sub elements, you should do it on subview creation with queryView method:

    onSubViewCreate:function(view, item){
       view.setValues(item);
       view.queryView({name:"title"}).attachEvent("onTimedKeyPress", function(){
         webix.message(this.getInputNode().value);
       });
     }
    

    https://snippet.webix.com/5m5fmlkr

  • edited December 2018

    Hello!
    Good news! We fixed the bug.
    The fix is already available in Webix 6.1.2 Pro.
    In GPL version the fix will appear in 6.2.

  • Hi thanks, but I have find the same bug when I remove a row and then add a new row.
    Also this bug is fixed?

  • Hello,

    Again, thanks for reporting. The nearest minor version will include this bug fix as well.

  • Hi, I dont test the Webix 6.1.2 Pro but the workaround generates errors in internet explorer 11

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!