Results 1 to 3 of 3

Thread: InsertAfter

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    6
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Answers
    3885
    Vote Rating
    1297
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •