Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    11
    Vote Rating
    0
    SammyLi is on a distinguished road

      0  

    Default Different behavior between development and build - View - Ajax - initialize

    Different behavior between development and build - View - Ajax - initialize


    Hey!

    I am not sure, if it would be better to report this in different thread and I also think, the view/ajax-part may be caused by my source, but because sencha behaves the way I don't expect, I will only start this thread at first:

    1)
    My code is fully functional when developing. Everything works fine: Main is started, this starts Frame, initialize is called, html is loaded an successfully updated.

    2)
    When building with 'package'-parameter the initialize-function is not called, so there is no html loaded.

    3)
    When using 'production', the first call gives the same result like 2). The 2nd problem occurs:
    - I do some changes (i.e. changing the initial html)
    - build again
    - first refresh
    - the app asks me to reload itself
    - app reloads an logs into the console:

    Malformed delta content received for http://localhost/app.js http://localhost/:56
    G http://localhost/:56
    (anonymous function) http://localhost/:59
    h.onreadystatechange http://localhost/:54
    - second, third, n-th refresh:
    - console logs something like
    error evaluating http://localhost/app.js with message: SyntaxError: Unexpected token ; http://localhost/:56
    G http://localhost/:56
    c http://localhost/:57
    b http://localhost/:57
    ...
    The 'unexpected token' changes from time to time.

    I found this many time in different forums, but I never read an answer. And just to be sure:
    The code works fine when in development, so there must be something with generated code / caching mechanism.

    Questions:
    - Why is the initialize-function not called when using the build. What did I miss?
    - What's wrong with the generated delta / caching?


    Here is my code:
    Main:
    Code:
    Ext.define('EBook.view.Main', {
        extend: 'Ext.Container',
        
        requires: 'Ext.carousel.Carousel',
        
        config: {
            layout: 'fit',
            fullscreen: true,
            cls: 'main',
            
            items: [ {
                    xtype: 'carousel',
    
                    items: [ {
                            title: 'FRAME',
                            xtype: 'frame',
                            cls: 'card'
                    } ]
            } ]
        }
    });
    Frame:
    Code:
    Ext.define("EBook.view.Frame", {
        extend: "Ext.Container",
        
        requires: [
                   "Ext.Ajax",
                   "Ext.Img"
                  ],
    
        alias: "widget.frame",
        
        autoCreate: true,
    
        config: {
            layout: {
                type: 'vbox',
            },
            
            items: [
                    {
                        xtype: 'panel',
                        layout: 'hbox',
                        cls: 'card-header',
                        items: [ { xtype: 'panel', html: 'ShowMe.htm', cls: 'card-titel' } ]
                    },
                    {
                        xtype: 'panel',
                        cls: 'card-content style_3',
                        html: 'initial html...',
    
                        flex: 1,
                        height: 938,
                        scrollable: 'vertical',
    
                        initialize: function () {
                               console.log('initialize');
                               this.setHtml("static content via this.setHtml()");
                               Ext.Ajax.request({
                                   scope: this,
                                   url: './resources/showme.htm',
                                   success: function ( response ) {
                                       console.log('success');
                                       console.log(response);
                                       this.setHtml(response.responseText);
                                   },
                                   failure: function ( response ) {
                                       console.log('failure');
                                       console.log(response);
                                       this.setHtml("error: " + response.status);
                                   }
                               });
                           }
                    }
    
            ]
        }
    });

  2. #2
    Sencha User
    Join Date
    May 2012
    Posts
    11
    Vote Rating
    0
    SammyLi is on a distinguished road

      0  

    Default


    OK. Two days of testing, editing, probing, hoping, crying and more whatever-ing and an hour after posting, I see it:

    The way I defined the Frame-view, the initialize-function seems to be part of the items config-block. I defined an other directly as part of Frame an it is called in the build.
    Questions have changed a bit:

    1. Why does the build behave other than the development (why does it even work?!).
    2. What problems does the delta-cache-mechanism have with this kind of config?
    3. Is there a way to pass the initialize-function to the child item? I would like to save an own class-file.

    ---

    With using an extra file for the frame-html-item, initialize is called, but I still can't run with 'production' generated deltas!

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    It is not recommended to override methods like that anyway. If you need to do that, create a new class.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    11
    Vote Rating
    0
    SammyLi is on a distinguished road

      0  

    Default Sorry, but....

    Sorry, but....


    ....please don't take this personal, but...

    ... I saw a lot of answers written by you, which really missed the target. That was, why I wrote exactly this:
    I found this many time in different forums, but I never read an answer. And just to be sure:
    The code works fine when in development, so there must be something with generated code / caching mechanism.
    The 'right' Sencha-way is the one thing, the other is, that there is a different behavior between executing the development-sources and the build sources. That was the first point.

    The second is, that there is still a problem with the delta-builds and I found that error very often. Maybe, this is because of fault like I did, but this shows only, that point 1 is more important.

    Point 3)
    What means ' not recommended'? Is there a way to do that (without an own class-file) or is it still not possible?

    ---

    This Thread was started in the bug-subforum because of the points 1 and 2 (and I tried to explain that in the first post).
    If these point are really [Closed] in Sencha opinion, than this is a reason to not use sencha in our company. That kind of behavior costs a lot of developers time.

    Please don't missunderstand me. I believe, that you read a very lot of bug, questions etc every day and therefor have to tally them fast and I can understand this. But from my point of view, you underestimate, what it means to develop a running app without being able to build it and without having a chance to debug it.

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you need to override the initialize method, then you need to create your own class. It is not recommended nor valid as a config, the initialize method is not a config.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha User
    Join Date
    May 2012
    Posts
    11
    Vote Rating
    0
    SammyLi is on a distinguished road

      0  

    Default


    OK, so it is not possible, that makes sense.... understood.

    I hope you recognized the two things that I reported as some kind of bug.
    Thx

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."