In the following extJS page, when I click the button, the content of the HTML Div "buttonInfo" changes correctly.
I want to also change the contents of the panel that I created with extJS.
However, when I change the contents of the panel as I do the div, the whole panel is simply replaced.
How can I change the contents of my panel object from within my button's click handler?
before:
after:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<style type="text/css">
body {
padding: 20px;
}
div#infoBox {
margin: 10px 0 0 0;
width: 190px;
height: 100px;
background-color: lightblue;
padding: 10px;
}
div#content {
margin: 10px 0 0 0;
}
div.x-panel-body {
padding: 10px;
}
</style>
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all-debug.js"></script>
<title>Simple extJS</title>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';
Ext.onReady(function(){
Ext.get('buttonInfo').on('click', function(){
Ext.get('infoBox').update('This is the <b>new</b> content.');
Ext.get('panel1').update('new info');
//Ext.get('panel1').html = 'new info111'; //doesn't work
//panel1.html = 'new info222'; //doesn't work
});
new Ext.Panel({
id: 'panel1',
renderTo: 'content',
width: '210px',
title: 'Extended Info',
html: 'original text',
collapsible: true
});
});
</script>
</head>
<body>
<button id="buttonInfo">
Show Info
</button>
<div id="infoBox">
</div>
<div id="content-wrapper">
<div id="content"></div>
</div>
</body
>