Skip to content

Commit 21e3adc

Browse files
Richard van DijkRichard van Dijk
authored andcommitted
stop using websocket URL as panel id (fix #12)
It is incompatible with later versions of Ext JS.
1 parent 9d4558c commit 21e3adc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

demo/demo.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ Ext.define ('DEMO.view.OpenConnection', {
2222
url: url ,
2323
listeners: {
2424
open: function (ws) {
25-
if (Ext.get(ws.url)) Ext.get(ws.url).dom.innerHTML += '> WebSocket just open!<br/>';
25+
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
26+
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
27+
messageBox.innerHTML += '> WebSocket just open!<br/>';
2628
} ,
2729
message: function (ws, data) {
28-
Ext.get(ws.url).dom.innerHTML += '> ' + data + '<br/>';
30+
var container = Ext.ComponentQuery.query('panel[title="' + url + '"] > container#messageCt')[0];
31+
var messageBox = container.getEl().dom.getElementsByClassName("messageBox")[0];
32+
messageBox.innerHTML += '> ' + data + '<br/>';
2933
} ,
3034
close: function (ws) {
31-
var panel = Ext.getCmp ('panel' + ws.url);
35+
var panel = Ext.ComponentQuery.query('panel[title="' + url + '"]')[0];
3236

3337
if ((panel != null) || (panel != undefined)) {
3438
panel.destroy ();
@@ -41,7 +45,6 @@ Ext.define ('DEMO.view.OpenConnection', {
4145
var panel = Ext.create ('Ext.panel.Panel', {
4246
title: url ,
4347
ws: ws ,
44-
id: 'panel' + url ,
4548

4649
layout: 'anchor' ,
4750

@@ -50,7 +53,8 @@ Ext.define ('DEMO.view.OpenConnection', {
5053

5154
items: [{
5255
xtype: 'container' ,
53-
html: 'Incoming from the server:<br/><div id="' + url + '" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>'
56+
html: 'Incoming from the server:<br/><div class="messageBox" style="height: 60px; border: black solid 1px; padding: 5px; margin: 5px 0 5px 0; overflow: auto"></div>' ,
57+
itemId: 'messageCt'
5458
} , {
5559
xtype: 'textarea' ,
5660
labelAlign: 'top' ,

0 commit comments

Comments
 (0)