Ext.onReady() vs $(document).ready()

后端 未结 3 718
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 11:54

Whats the difference? I have on $(document).ready function which should check if extjs is loaded but the main problem is extjs does not load on time and things inside $(document

3条回答
  •  心在旅途
    2021-02-15 12:17

    They both check for when the DOM is ready. If you need Ext to be loaded when using jQuery, try to invert the logic (don't know if it will work, haven't tried).

    Ext.onReady(function() {
        $(document).ready(function() {
            Ext.create('Ext.Button', {...});
        });
    });
    

    Another StackOverflow question on this subject: Extjs + jQuery together

提交回复
热议问题