Skip to content

Instantly share code, notes, and snippets.

@heronmedeiros
Forked from cmilfont/book.js
Created November 30, 2012 00:50
Show Gist options
  • Save heronmedeiros/4172998 to your computer and use it in GitHub Desktop.
Save heronmedeiros/4172998 to your computer and use it in GitHub Desktop.
Ext.define('Book', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'},
{name: 'title', type: 'string'},
{name: 'thumb_image_path', type: 'string'},
{name: 'user_id', type: 'int'}
],
proxy: { url: "/books", type: 'rest', format: "json" }
});
Ext.define("BooksGrid", {
extend: "Ext.grid.Panel",
alias: "widget.booksgrid",
abrirTela: function(record) {
Ext.create('Ext.window.Window', {
title: "Editar livro", modal:true,
width: 400,
items: [{xtype: "booksformpanel", model: record}]
}).show();
},
initComponent: function() {
this.columns = [{
header: "Title", dataIndex: "title"
}];
this.store = {model: "Book"};
this.listeners = {
itemdblclick: {
scope: this,
fn: function(g, record){ this.abrirTela(record) }
}
};
this.callParent(arguments);
this.store.load();
}
})
Ext.create('Ext.window.Window', {
title: "Lista de livros",
width: 400,
items: [{xtype: "booksgrid"}]
}).show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment