1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    6
    Vote Rating
    0
    jinggovillamor is on a distinguished road

      0  

    Default Unanswered: InsertAfter

    Unanswered: InsertAfter


    I used XTemplate to render my blog post.

    Code:
    var tpl = new Ext.XTemplate(
                '<tpl for=".">',
                '<div class="row-content-inner">',
                '        <div class="row_profile"><div class="profile_pic"><img src="{photo}" width="50"/></div>{fname}<div class="clear"></div></div>',
                '        <div class="row_message">{message}</div>',
                '        <tpl if="this.isImageEmpty(image_url)">',
                '                <div class="img_post"><div class="img_wrapper"><img src="{image_url}"/></div>{description}</div>',
                '        </tpl>',
                '        <div>',
                '            <tpl for="comments">',
                '                <div id="commentbox">{c_created} - {comment}</div>',
                '            </tpl>',
                '        </div>',
                '</tpl>',
                {
                    isImageEmpty: function(image)
                    {
                        return image != "";
                    }
                }
            );
    My goal is to append my text from here <div id="commentbox">.

    Here is my attempt in my Controller which is an experiment.

    Code:
    addComment: function() {
    
    
            var tpl = this.getBlogDetails().getTpl();
            
            tpl.insertAfter('#commentbox','test');
    }
    Nothing works in all my attempts.

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


    Why not just use the tpl with if or whatever you need so it's all setup before hand?

    Also, I wouldn't have a bunch of spaces within the string for indention, I would just indent the actual string so when you compile that extra indention is removed to save space.
    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 User
    Join Date
    Dec 2012
    Posts
    6
    Vote Rating
    0
    jinggovillamor is on a distinguished road

      0  

    Default


    Hi mitchellsimoens

    My intention here is to append the text from textfield right away to the template so it just looks like realtime update and then ajax post will be called after it append. When ajax errors will pop a message then removed the appended comment.

    Thank you for telling me about indention.


Thread Participants: 1

Tags for this Thread