Created
April 14, 2011 14:55
-
-
Save lusabo/919644 to your computer and use it in GitHub Desktop.
Exemplo - Curso ExtJs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TwitterReader = new Ext.data.JsonReader({ | |
idProperty: 'id', | |
root: 'users', | |
totalProperty: 'results', | |
fields: [ | |
{name: 'description', mapping: 'description'}, | |
{name: 'profile_image_url', mapping: 'profile_image_url'}, | |
{name: 'name', mapping: 'name'}, | |
{name: 'screen_name', mapping: 'screen_name'} | |
] | |
}); | |
var TwitterProxy = new Ext.data.ScriptTagProxy({ | |
url: 'http://api.twitter.com/1/lusabo/organizacao-linguagil/members.json', restful: true | |
}); | |
var store = new Ext.data.Store({ reader: TwitterReader, proxy: TwitterProxy }); | |
var cm = new Ext.grid.ColumnModel({ | |
defaults: { | |
width: 100, sortable: true | |
}, | |
columns: [ | |
{ header: "Descrição", width: 200, dataIndex: "description"}, | |
{ header: "Nome", width: 200, dataIndex: "name"}, | |
{ header: "Perfil", dataIndex: "screen_name"} | |
] | |
}); | |
var grid = new Ext.grid.GridPanel({ | |
store: store, | |
sm: new Ext.grid.RowSelectionModel({singleSelect:true}), | |
title: "Lista do Twitter", | |
width: 600, height: 200, | |
cm: cm | |
}); | |
var callback = function(records) { | |
console.dir(records); | |
grid.render("palestrantes"); | |
} | |
store.load({ | |
callback: callback | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment