qTip2 / qTip2

qTip2 - Pretty powerful tooltips
MIT License
2k stars 465 forks source link

Cannot read property 'show' of null backbone #813

Open jvonrudno opened 7 years ago

jvonrudno commented 7 years ago

Hi guys!!

I have the following situation:

myModel = Backbone.Model.extend({ url: myUrl, defaults:{ categories: [], . . . }, });

myView = Marionette.LayoutView.extend({ initialize:function(){ this.model = new myModel(); this.fillCategories(); },

   fillCategories: function (){
    jQuery.ajax({
        url: otherURL,
        context: this,

        success: function(d){
            if(d ){
                this.model.set({categories: eval(d)});
            }
        },
    });
},

});

I load the data for model attributes by fetch the model, using the url that I have define in the model, but I need to load the data for the attribute categories (This is a combobox field in the view) from another url (different table), for this reason in the method initialize I execute the method "fillCategories". In this method I execute an jquery ajax to get the data and set the attribute categories with this data.

All this task are working properly, but after execute the command to set the category i get in console the error message: Uncaught TypeError: Cannot read property 'show' of null at cmcom:1159 (anonymous) @ cmcom:1159

I am not sure if this is the best practice to fill the data from a combobox when this data come from a different table.

In advance, thousand thanks for your help!!

Regards!!

Jorge von Rudno