📄 samplescripts.debug.js
字号:
grid.render();
(grid.getSelectionModel()).selectFirstRow();
},
_italic: function SampleScripts_grid_ArrayGridScript$_italic(val) {
return '<i>' + val + '</i>';
},
_change: function SampleScripts_grid_ArrayGridScript$_change(val) {
if (val > 0) {
return '<span style=\"color:green;\">' + val + '</span>';
}
else if (val < 0) {
return '<span style=\"color:red;\">' + val + '</span>';
}
return val;
},
_pctChange: function SampleScripts_grid_ArrayGridScript$_pctChange(val) {
if (val > 0) {
return '<span style=\"color:green;\">' + val + '%</span>';
}
else if (val < 0) {
return '<span style=\"color:red;\">' + val + '%</span>';
}
return val;
},
_getMyData: function SampleScripts_grid_ArrayGridScript$_getMyData() {
return [ [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ] ];
}
}
////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.EditGridScript
SampleScripts.grid.EditGridScript = function SampleScripts_grid_EditGridScript() {
}
SampleScripts.grid.EditGridScript.main = function SampleScripts_grid_EditGridScript$main(args) {
ExtClass.onReady(Delegate.create(null, function() {
new SampleScripts.grid.EditGridScript().init();
}));
}
SampleScripts.grid.EditGridScript.prototype = {
init: function SampleScripts_grid_EditGridScript$init() {
var checkCol = new SampleScripts.grid.CheckColumn(new Ext.grid.ColumnModelConfig().header('Indoor?').dataIndex('indoor').width(55).toDictionary());
var cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().id('common').header('Common Name').dataIndex('common').width(220).editor(new Ext.form.TextField(new Ext.form.TextFieldConfig().allowBlank(false).toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Light').dataIndex('light').width(130).editor(new Ext.form.ComboBox(new Ext.form.ComboBoxConfig().typeAhead(true).triggerAction('all').transform('light').lazyRender(true).listClass('x-combo-list-small').toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Price').dataIndex('price').width(70).align('right').renderer(Delegate.create(null, Ext.util.Format.usMoney)).editor(new Ext.form.NumberField(new Ext.form.NumberFieldConfig().allowBlank(false).allowNegative(false).maxValue(100000).toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Available').dataIndex('availDate').width(95).renderer(Delegate.create(this, this.formatDate)).editor(new Ext.form.DateField(new Ext.form.DateFieldConfig().format('m/d/y').minValue('01/01/06').disabledDays([ 0, 6 ]).disabledDaysText('Plants are not available on the weekends').toDictionary())).toDictionary(), checkCol ]);
cm.defaultSortable = true;
var plantDef = [ { name: 'common', type: 'string' }, { name: 'botanical', type: 'string' }, { name: 'light' }, { name: 'price', type: 'float' }, { name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y' }, { name: 'indoor', type: 'bool' } ];
var ds = new Ext.data.Store(new Ext.data.StoreConfig().url('plants.xml').reader(new Ext.data.XmlReader(new Ext.data.XmlReaderConfig().record('plant').toDictionary(), plantDef)).sortInfo({ field: 'common', direction: 'ASC' }).toDictionary());
var grid = null;
grid = new Ext.grid.EditorGridPanel(new Ext.grid.EditorGridPanelConfig().ds(ds).cm(cm).renderTo('editor-grid').width(600).height(300).autoExpandColumn('common').title('Edit Plants?').frame(true).plugins(checkCol).clicksToEdit(1).tbar([ { text: 'Add Plant', handler: Delegate.create(this, function() {
var p = new Ext.data.Record(plantDef);
grid.stopEditing();
ds.insert(0, [ p ]);
p.set('common', 'New Plant 1');
p.set('light', 'Mostly Shade');
p.set('price', 0);
p.set('availDate', new Date());
p.set('indoor', false);
grid.startEditing(0, 0);
}) } ]).toDictionary());
ds.load();
},
formatBoolean: function SampleScripts_grid_EditGridScript$formatBoolean(value) {
return (value) ? 'Yes' : 'No';
},
formatDate: function SampleScripts_grid_EditGridScript$formatDate(value) {
return (isNullOrUndefined(value)) ? '' : value.dateFormat('M d, Y');
}
}
////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.CheckColumn
SampleScripts.grid.CheckColumn = function SampleScripts_grid_CheckColumn(config) {
ExtClass.apply(this, config, null);
if (isNullOrUndefined(this.id)) {
this.id = ExtClass.id();
}
}
SampleScripts.grid.CheckColumn.prototype = {
id: null,
dataIndex: null,
grid: null,
init: function SampleScripts_grid_CheckColumn$init(g) {
this.grid = g;
this.grid.on('render', Delegate.create(this, function() {
var view = this.grid.getView();
var el = view.mainBody;
el.on('mousedown', Delegate.create(this, this.onMouseDown), this);
}), this);
},
onMouseDown: function SampleScripts_grid_CheckColumn$onMouseDown(e, t) {
if (!isNullOrUndefined(t.className) && t.className.indexOf('x-grid3-cc-' + this.id) !== -1) {
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
var val = record.get(this.dataIndex);
record.set(this.dataIndex, !val);
}
},
renderer: function SampleScripts_grid_CheckColumn$renderer(value, p, record) {
p['css'] += ' x-grid3-check-col-td';
return '<div class=\"x-grid3-check-col' + ((value) ? '-on' : '') + ' x-grid3-cc-' + this.id + '\"> </div>';
}
}
////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.GroupingGridScript
SampleScripts.grid.GroupingGridScript = function SampleScripts_grid_GroupingGridScript() {
}
SampleScripts.grid.GroupingGridScript.main = function SampleScripts_grid_GroupingGridScript$main(args) {
ExtClass.onReady(Delegate.create(null, function() {
new SampleScripts.grid.GroupingGridScript().init();
}));
}
SampleScripts.grid.GroupingGridScript.prototype = {
init: function SampleScripts_grid_GroupingGridScript$init() {
var reader = new Ext.data.ArrayReader(new Ext.data.ArrayReaderConfig().toDictionary(), [ { name: 'company' }, { name: 'price', type: 'float' }, { name: 'change', type: 'float' }, { name: 'pctChange', type: 'float' }, { name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia' }, { name: 'industry' }, { name: 'desc' } ]);
var gds = new Ext.data.GroupingStore(new Ext.data.GroupingStoreConfig().reader(reader).data(this._getData()).sortInfo({ field: 'company', direction: 'ASC' }).groupField('industry').toDictionary());
var columns = [ { id: 'company', header: 'Company', width: 60, sortable: true, dataIndex: 'company' }, { header: 'Price', width: 20, sortable: true, renderer: Delegate.create(null, Ext.util.Format.usMoney), dataIndex: 'price' }, { header: 'Change', width: 20, sortable: true, dataIndex: 'change', renderer: Delegate.create(null, Ext.util.Format.usMoney) }, { header: 'Industry', width: 20, sortable: true, dataIndex: 'industry' }, { header: 'Last Updated', width: 20, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange' } ];
var view = new Ext.grid.GroupingView(new Ext.grid.GroupingViewConfig().forceFit(true).groupTextTpl('{text} ({[values.rs.length]} {[values.rs.length > 1 ? \"Items\" : \"Item\"]})').toDictionary());
var grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().ds(gds).columns(columns).view(view).frame(true).width(700).height(400).collapsible(true).animCollapse(false).title('Grouping Example').iconCls('icon-grid').renderTo(document.body).toDictionary());
},
_getData: function SampleScripts_grid_GroupingGridScript$_getData() {
return [ [ '3m Co', 71.72, 0.02, 0.03, '4/2 12:00am', 'Manufacturing' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '4/1 12:00am', 'Manufacturing' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '4/3 12:00am', 'Manufacturing' ], [ 'American Express Company', 52.55, 0.01, 0.02, '4/8 12:00am', 'Finance' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '4/1 12:00am', 'Services' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '4/8 12:00am', 'Services' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '4/8 12:00am', 'Manufacturing' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '4/1 12:00am', 'Services' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '4/4 12:00am', 'Finance' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '4/1 12:00am', 'Manufacturing' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '4/3 12:00am', 'Manufacturing' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '4/3 12:00am', 'Manufacturing' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '4/3 12:00am', 'Automotive' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '4/3 12:00am', 'Computer' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '4/3 12:00am', 'Manufacturing' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '4/2 12:00am', 'Computer' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '4/1 12:00am', 'Computer' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '4/2 12:00am', 'Medical' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '4/2 12:00am', 'Finance' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '4/2 12:00am', 'Food' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '4/2 12:00am', 'Medical' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '4/2 12:00am', 'Computer' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '4/8 12:00am', 'Services', 'Medical' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '4/1 12:00am', 'Food' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '4/8 12:00am', 'Retail' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '4/1 12:00am', 'Manufacturing' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '4/1 12:00am', 'Computer' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '4/3 12:00am', 'Services' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '4/3 12:00am', 'Retail' ], [ 'Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.81, '4/1 12:00am', 'Services' ] ];
}
}
////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.PagingGridScript
SampleScripts.grid.PagingGridScript = function SampleScripts_grid_PagingGridScript() {
}
SampleScripts.grid.PagingGridScript.main = function SampleScripts_grid_PagingGridScript$main(args) {
ExtClass.onReady(Delegate.create(null, function() {
new SampleScripts.grid.PagingGridScript().init();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -