3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.ns('App', 'App.user');
9 <div id="prop-Ext.ux.TaskBar.TaskButton-Grid"></div>/**
11 * A typical EditorGridPanel extension.
13 App.user.Grid = Ext.extend(Ext.grid.EditorGridPanel, {
14 renderTo: 'user-grid',
20 style: 'margin-top: 10px',
22 initComponent : function() {
29 // relay the Store's CRUD events into this grid so these events can be conveniently listened-to in our application-code.
30 this.relayEvents(this.store, ['destroy', 'save', 'update']);
32 // build toolbars and buttons.
33 this.tbar = this.buildTopToolbar();
34 this.bbar = this.buildBottomToolbar();
35 this.buttons = this.buildUI();
38 App.user.Grid.superclass.initComponent.call(this);
41 <div id="method-Ext.ux.TaskBar.TaskButton-buildTopToolbar"></div>/**
44 buildTopToolbar : function() {
52 iconCls: 'silk-delete',
53 handler: this.onDelete,
58 <div id="method-Ext.ux.TaskBar.TaskButton-buildBottomToolbar"></div>/**
61 buildBottomToolbar : function() {
62 return ['<b>@cfg:</b>', '-', {
66 tooltip: 'When enabled, Store will execute Ajax requests as soon as a Record becomes dirty.',
67 toggleHandler: function(btn, pressed) {
68 this.store.autoSave = pressed;
75 tooltip: 'When enabled, Store will batch all records for each type of CRUD verb into a single Ajax request.',
76 toggleHandler: function(btn, pressed) {
77 this.store.batch = pressed;
81 text: 'writeAllFields',
83 tooltip: 'When enabled, Writer will write *all* fields to the server -- not just those that changed.',
84 toggleHandler: function(btn, pressed) {
85 store.writer.writeAllFields = pressed;
91 <div id="method-Ext.ux.TaskBar.TaskButton-buildUI"></div>/**
94 buildUI : function() {
103 <div id="method-Ext.ux.TaskBar.TaskButton-onSave"></div>/**
106 onSave : function(btn, ev) {
110 <div id="method-Ext.ux.TaskBar.TaskButton-onAdd"></div>/**
113 onAdd : function(btn, ev) {
114 var u = new this.store.recordType({
120 this.store.insert(0, u);
121 this.startEditing(0, 1);
124 <div id="method-Ext.ux.TaskBar.TaskButton-onDelete"></div>/**
127 onDelete : function(btn, ev) {
128 var index = this.getSelectionModel().getSelectedCell();
132 var rec = this.store.getAt(index[0]);
133 this.store.remove(rec);