1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    58
    Vote Rating
    0
    Answers
    1
    pret is on a distinguished road

      0  

    Default Unanswered: Chat-style Panel: Best way to update the conversation area?

    Unanswered: Chat-style Panel: Best way to update the conversation area?


    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.

  2. #2
    Sencha User
    Join Date
    Sep 2010
    Posts
    58
    Vote Rating
    0
    Answers
    1
    pret is on a distinguished road

      0  

    Default


    Mmm.. or maybe I could use a Ext.view.View to display the messages? I didn't use it yet, but looking at the examples it looks like a good way to handle this.

    What do you think?