Hi guys,
I'm developing a messenger-like chat system. I have a window with this items:
Code:
initComponent: function() { this.items = [{
id: 'this-is-the-conversation-panel!!!',
region: 'center',
padding: 5,
bodyStyle: 'padding: 5px',
autoScroll: true
}, {
region: 'south',
height: 145,
padding: 5,
layout: 'hbox',
items: [{
xtype: 'htmleditor',
height: 135,
flex: 1,
fieldType: 'message'
}, {
xtype: 'button',
text: 'Send',
width: 80,
height: '100%',
handler: this.onSendMessageButtonClick,
scope: this
}]
}];
this.callParent(arguments);
},
Now, I want to update the conversation panel with the new messages that are sent in the conversation. Which would be the best way for this? I could directly update the html of the panel, but I still haven't found a way to get the actual content of it. I know that I can do:
Code:
myConversationPanel.update(newMessageHtml);
But this would, indeed, erase the original content of the panel. I haven't found a way in the API to access the original content and do something like:
Code:
myConversationPanel.update(myConversationPanel.getContent() + newMessageHtml);
With that code I could make it work. Does someone know how to access the original content of the panel? or is there a better way to handle this? maybe with one Ext.core.Element for each message?
Thanks in advance.