44119

How can I access other extJS objects from within extJS click events?

Question:

In the below code in the click event for my menuItem1 object, how can I change the html content of the renderContent object so when the user clicks the menu item's header, the content in the middle of the page changes?

(In all the examples I look at, the click events are creating new objects but not changing existing objects.)

Ext.onReady(function(){ var menuItem1 = new Ext.Panel({ id: 'panelStart', title: 'Start', html: 'This is the start menu item.', cls:'menuItem' }); var menuItem2 = new Ext.Panel({ id: 'panelApplication', title: 'Application', html: 'this is the application page', cls:'menuItem' }); var regionMenu = new Ext.Panel({ region:'west', split:true, width: 210, layout:'accordion', layoutConfig:{ animate:true }, items: [ menuItem1, menuItem2 ] }); var regionContent = new Ext.Panel({ region: 'center', padding:'10', autoScroll: true, html: 'this is the content' }); new Ext.Viewport({ layout: 'border', items: [ regionMenu, regionContent ] }); menuItem1.header.on('click', function() { alert('this appears in alert window'); // regionContent.set('html', 'new text'); //nothing appears, no error // regionContent.set('html', 'new text'); //nothing appears, no error // Ext.get('regionContent').html = 'new text'; //error: "regionContent is null" // Ext.getCmp('contentArea').html = 'the new text'; //nothing appears, no error // Ext.getCmp('contentArea').set('html', 'new text'); //error: "set is not a function" }); });

Answer1:

Try using the "update" method:

regionContent.update('new text');

Recommend

  • jwplayer: using seek(), onTime() and stop() to play part of the video
  • Youtube Closed Caption for HTML5 Not Working
  • Ajax response that slides open a div
  • Extjs layout extension causing error in ext-all.js
  • Flask-Restful error: “as_view” method not inherited
  • Visual Studio 2008 and JavaScript brackets formatting
  • composer dependency stating in doesn't have php-xsl
  • Primefaces lazy datascroller calling load twice
  • apply a javascript function to draggable copy
  • How to access meteor package name inside package?
  • Rest Services conventions
  • SonarQube: Cannot deactivate rule with missing quality profile
  • Android changing fragment order inside FragmentPagerAdapter
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • How to use JavaScript to determine whether a file exists in a directory?
  • Date Conversion from yyyy-mm-dd to dd-mm-yyyy
  • Debug.DrawLine not showing in the GameView
  • Create DicomImage from scratch using Dcmtk
  • Groovy: Unexpected token “:”
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • Row Count Is Returning the incorrect number using RaptureXML
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Initializer list vs. initialization method
  • Control modification in presentation layer
  • CSS Linear-gradient formatting issue accross different browsers
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Fetching methods from BroadcastReceiver to update UI
  • WinForms: two way TextBox problem
  • To display the title for the current loaction in map in iphone
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • trying to dynamically update Highchart column chart but series undefined
  • python regex in pyparsing
  • Android Google Maps API OnLocationChanged only called once
  • Binding checkboxes to object values in AngularJs
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?