-
1 Nov 2011 12:44 PM #1
Answered: How to access inner html of a card
Answered: How to access inner html of a card
I want to update a card using ajax - I pulled the kitchensink example but it turns out it doesn't work in card layout because the content seen on screen is not the actual item as defined in the items: sectionof my view - I guess the card layout duplicates content. So technically the ajax works but it doesn't update the visible card part. Is there a way to sync the visible with hidden part of a card? I hope this makes sense.
-
Best Answer Posted by mitchellsimoens
Use the magical getter for it:
getHtml method is automatically created because we passed in the html config on our container.Code:var panel = Ext.create('Ext.Panel', { fullscreen : true, layout : 'card', items : [ { xtype : 'container', html : 'Hello' } ] }); var html = panel.down('container').getHtml();
-
1 Nov 2011 12:56 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
Use the magical getter for it:
getHtml method is automatically created because we passed in the html config on our container.Code:var panel = Ext.create('Ext.Panel', { fullscreen : true, layout : 'card', items : [ { xtype : 'container', html : 'Hello' } ] }); var html = panel.down('container').getHtml();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.
-
1 Nov 2011 1:02 PM #3
How would that access this div with no ID? I don't understand why that would be different than what I have. This is one subview in a card layout.
Code:Ext.define('App.view.About', { extend: 'Ext.Container', xtype: 'about', initialize: function() { this.on({ scope: this, painted: 'onPainted', }); }, onPainted: function() { var panel = Ext.getCmp('ajax'); panel.update('new text'); }, config: { layout: 'vbox', scrollable: true, items: [{ docked: 'top', xtype : 'toolbar', items: [{ text: 'Back', back: 'hello', ui: 'back', }] }, { xtype: 'panel', id: 'ajax', styleHtmlContent: true, html: 'this should be replaced but it's not' } ]} });
-
1 Nov 2011 1:04 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
The component has a reference to where it places the html content so it grabs from that div.
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.
-
1 Nov 2011 1:05 PM #5
But I guess it works
Thanks.
I replaced var panel = Ext.getCmp('ajax'); with var panel = this.down('panel');


Reply With Quote