1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    27
    Vote Rating
    1
    hebr3 is on a distinguished road

      0  

    Default How to refresh panel

    How to refresh panel


    Hi,
    I have a panel and change in a program the html content. How can I refresh the panel so that I see alway the actual html content?
    Thanks and best regards
    hebr3

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    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


    How do you change the html content?
    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.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    27
    Vote Rating
    1
    hebr3 is on a distinguished road

      0  

    Default


    - I have a panel defined
    - build the string in a variable (page_html)
    - set the html using the method setHtml().

    The following works now but I would like to know whether there is an easier way to "refresh" the parent container.

    Code:
     
     //... resultTable is a var pointing to a panel object, page_html has the html (as a string)
     resultTable.setHtml(page_html);
     Ext.getCmp('DK_round').remove([resultTable]);    // has been added before
     Ext.getCmp('DK_round').add([resultTable]);
    //...

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    12
    Vote Rating
    0
    DeepShah is on a distinguished road

      0  

    Default


    It will work


    You can set new html by following code


    Ext.getCmp("id_of_panel").setHtml(page_html);

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    27
    Vote Rating
    1
    hebr3 is on a distinguished road

      0  

    Default


    well, in my case it did not do an automatic refresh without "Ext.getCmp('DK_round').add([resultTable])". The add-method triggered the refresh but not the setHtml-method.

  6. #6
    Sencha User
    Join Date
    Apr 2012
    Location
    California
    Posts
    10
    Vote Rating
    1
    dlowerre is on a distinguished road

      1  

    Default


    Hey Mitchell, it doesn't seem like you provided any help here. You asked a question which got answered. How about a nice clear, descriptive response that actually helps people?

    I for one would like to know why setRecord does not change my display. I want to get the container to re-render but it will only do so if I navigate to another page and then come back to force the re-draw.

    It seems there used to be a useful function called doLayout but you guys decided it would be better to make it implicit. OK. WHERE is the refresh of the container accomplished? Using which methods? setData? setHtml? setRecord? Any of these? All of the above?

    Sencha is some cool stuff if you like reading code in the place of clear documentation.

    And while I am ranting I will repeat that if you, Mitch, would take half the time responding to posts that I just took with mine you would be a hundred times more helpful.

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    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


    I do not respond to rants. However I will say that we got rid of doLayout because we don't have control over layouts, they are CSS so the browser gets to do the magic. Add something to a container and the browser will render and lay it out. For data rendering, specify a tpl and use setData with the record data.
    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.

  8. #8
    Sencha User
    Join Date
    Apr 2012
    Location
    California
    Posts
    10
    Vote Rating
    1
    dlowerre is on a distinguished road

      0  

    Default


    Stick to those principles, I am sure you can defend them.

    Meanwhile, your non-response provided me with the clue to the answer so I will attempt to state it clearly in hopes that it might help some other frustrated programmer:

    if cont is my container (which includes a template)
    and mod is my model

    then to re-render the html for the container after making a change to the model:

    cont.setData( mod.getData(true) );

    This approach worked for me where cont.setRecord(mod) did not.