-// Let's pretend we rendered our grid-columns with meta-data from our ORM framework.
-var userColumns = [
- {header: "ID", width: 40, sortable: true, dataIndex: 'id'},
- {header: "Email", width: 100, sortable: true, dataIndex: 'email', editor: new Ext.form.TextField({})},
- {header: "First", width: 50, sortable: true, dataIndex: 'first', editor: new Ext.form.TextField({})},
- {header: "Last", width: 50, sortable: true, dataIndex: 'last', editor: new Ext.form.TextField({})}
-];
-
-
-Ext.onReady(function() {
- Ext.QuickTips.init();
-
- // use RowEditor for editing
- var editor = new Ext.ux.grid.RowEditor({
- saveText: 'Update'
+ var store = Ext.create('Ext.data.Store', {
+ autoLoad: true,
+ autoSync: true,
+ model: 'Person',
+ proxy: {
+ type: 'rest',
+ url: 'app.php/users',
+ reader: {
+ type: 'json',
+ root: 'data'
+ },
+ writer: {
+ type: 'json'
+ }
+ },
+ listeners: {
+ write: function(store, operation){
+ var record = operation.getRecords()[0],
+ name = Ext.String.capitalize(operation.action),
+ verb;
+
+
+ if (name == 'Destroy') {
+ record = operation.records[0];
+ verb = 'Destroyed';
+ } else {
+ verb = name + 'd';
+ }
+ Ext.example.msg(name, Ext.String.format("{0} user: {1}", verb, record.getId()));
+
+ }
+ }