Skip to content

Instantly share code, notes, and snippets.

@wilk
Last active December 24, 2015 20:49
Show Gist options
  • Save wilk/6860298 to your computer and use it in GitHub Desktop.
Save wilk/6860298 to your computer and use it in GitHub Desktop.
Ext.ux.data.proxy.WebSocket working test for Tree Panel and Tree Store
Ext.Loader.setConfig ({
enabled: true ,
paths: {
'Ext.ux': '../ux'
}
});
Ext.require (['Ext.ux.data.proxy.WebSocket']);
Ext.onReady (function () {
Ext.define ('User', {
extend: 'Ext.data.Model' ,
fields: [
{name: 'id', type: 'string'} ,
{name: 'age', type: 'int'} ,
{name: 'text', type: 'string'}
] ,
proxy: {
type: 'websocket' ,
storeId: 'myTreeStore',
url: 'ws://localhost:8888' ,
reader: {
type: 'json'
}
}
});
var treeStore = Ext.create ('Ext.data.TreeStore', {
storeId: 'myTreeStore',
model: 'User' ,
root: {
text: 'Ext JS' ,
children: [] ,
expanded: true
}
});
var treePanel = Ext.create ('Ext.tree.Panel', {
renderTo: Ext.getBody () ,
title: 'WebSocketed Tree' ,
width: 500 ,
height: 300 ,
store: treeStore
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment