-
5 Jan 2013 8:44 PM #1
Unanswered: InsertAfter
Unanswered: InsertAfter
I used XTemplate to render my blog post.
My goal is to append my text from here <div id="commentbox">.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 != ""; } } );
Here is my attempt in my Controller which is an experiment.
Nothing works in all my attempts.Code:addComment: function() { var tpl = this.getBlogDetails().getTpl(); tpl.insertAfter('#commentbox','test'); }
-
7 Jan 2013 9:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
7 Jan 2013 4:13 PM #3
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.


Reply With Quote