⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samplescripts.debug.js

📁 经典编程900例(C语言),主要是C基础知识
💻 JS
📖 第 1 页 / 共 5 页
字号:
    }));
}
SampleScripts.grid.PagingGridScript.prototype = {
    _grid: null,
    _cm: null,
    
    init: function SampleScripts_grid_PagingGridScript$init() {
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().custom('proxy', new Ext.data.ScriptTagProxy(new Ext.data.ScriptTagProxyConfig().url('http://extjs.com/forum/topics-browse-remote.php').toDictionary())).reader(new Ext.data.JsonReader(new Ext.data.JsonReaderConfig().root('topics').totalProperty('totalCount').id('threadid').toDictionary(), [ 'title', 'forumtitle', 'forumid', 'author', { name: 'replycount', type: 'int' }, { name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp' }, 'lastposter', 'excerpt' ])).remoteSort(true).toDictionary());
        ds.setDefaultSort('lastpost', 'desc');
        this._cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().id('topic').header('Topic').dataIndex('title').width(420).renderer(Delegate.create(this, this._renderTopic)).toDictionary(), new Ext.grid.ColumnModelConfig().header('Author').dataIndex('author').width(100).hidden(true).toDictionary(), new Ext.grid.ColumnModelConfig().header('Replies').dataIndex('replycount').width(70).align('right').toDictionary(), new Ext.grid.ColumnModelConfig().id('last').header('Last Post').dataIndex('lastpost').width(150).renderer(Delegate.create(this, this._renderLast)).toDictionary() ]);
        this._cm.defaultSortable = true;
        var tb = new Ext.PagingToolbar(new Ext.PagingToolbarConfig().pageSize(25).store(ds).displayInfo(true).displayMsg('Displaying topics {0} - {1} of {2}').emptyMsg('No topics to display').items([ '-', new Ext.ButtonConfig().pressed(true).enableToggle(true).text('Show Preview').cls('x-btn-text-icon details').toggleHandler(Delegate.create(this, this._toggleDetails)).toDictionary() ]).toDictionary());
        var viewConfig = new Ext.grid.GridViewConfig().forceFit(true).enableRowBody(true).custom('showPreview', true).getRowClass(Delegate.create(this, this._getRowClass));
        this._grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().el('topic-grid').width(700).height(500).title('ExtJS.com - Browse Forums').store(ds).cm(this._cm).trackMouseOver(false).sm(new Ext.grid.RowSelectionModel({ selectRow: Delegate.create(null, ExtClass.emptyFn) })).loadMask(true).viewConfig(viewConfig.toDictionary()).bbar(tb).toDictionary());
        this._grid.render();
        ds.load({ params: { start: 0, limit: 25, forumId: 4 } });
    },
    
    _toggleDetails: function SampleScripts_grid_PagingGridScript$_toggleDetails(btn, pressed) {
        var view = this._grid.getView();
        view.showPreview = pressed;
        view.refresh();
    },
    
    _getRowClass: function SampleScripts_grid_PagingGridScript$_getRowClass(record, index, rowParams, ds) {
        if (this._grid.getView().showPreview) {
            rowParams['body'] = '<p>' + record.get('excerpt') + '</p>';
            return 'x-grid3-row-expanded';
        }
        return 'x-grid3-row-collapsed';
    },
    
    _renderTopic: function SampleScripts_grid_PagingGridScript$_renderTopic(value, meta, rec) {
        return String.format('<b><a href=\"http://extjs.com/forum/showthread.php?t={2}\" target=\"_blank\">{0}</a></b>' + '<a href=\"http://extjs.com/forum/forumdisplay.php?f={3}\" target=\"_blank\">{1} Forum</a>', value, rec.get('forumtitle'), rec.get('id'), rec.get('forumid'));
    },
    
    _renderLast: function SampleScripts_grid_PagingGridScript$_renderLast(value, meta, rec) {
        return String.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), rec.get('author'));
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.TotalsGridScript

SampleScripts.grid.TotalsGridScript = function SampleScripts_grid_TotalsGridScript() {
}
SampleScripts.grid.TotalsGridScript.main = function SampleScripts_grid_TotalsGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.TotalsGridScript().init();
    }));
}
SampleScripts.grid.TotalsGridScript.prototype = {
    
    init: function SampleScripts_grid_TotalsGridScript$init() {
        var reader = new Ext.data.JsonReader(new Ext.data.JsonReaderConfig().custom('idProperty', 'taskId').custom('fields', [ { name: 'projectId', type: 'int' }, { name: 'project', type: 'string' }, { name: 'taskId', type: 'int' }, { name: 'description', type: 'string' }, { name: 'estimate', type: 'float' }, { name: 'rate', type: 'float' }, { name: 'cost', type: 'float' }, { name: 'due', type: 'date', dateFormat: 'm/d/Y' } ]).toDictionary());
    },
    
    _getData: function SampleScripts_grid_TotalsGridScript$_getData() {
        return [ { projectId: 100, project: 'Ext Forms: Field Anchoring' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping' }, { projectId: 102, project: 'Ext Grid: Summary Rows' } ];
    },
    
    _getProjects: function SampleScripts_grid_TotalsGridScript$_getProjects() {
        return [ { projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 112, description: 'Integrate 2.0 Forms with 2.0 Layouts', estimate: 6, rate: 150, due: '06/24/2007' }, { projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 113, description: 'Implement AnchorLayout', estimate: 4, rate: 150, due: '06/25/2007' }, { projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 114, description: 'Add support for multiple types of anchors', estimate: 4, rate: 150, due: '06/27/2007' }, { projectId: 100, project: 'Ext Forms: Field Anchoring', taskId: 115, description: 'Testing and debugging', estimate: 8, rate: 0, due: '06/29/2007' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 101, description: 'Add required rendering \"hooks\" to GridView', estimate: 6, rate: 100, due: '07/01/2007' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 102, description: 'Extend GridView and override rendering functions', estimate: 6, rate: 100, due: '07/03/2007' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 103, description: 'Extend Store with grouping functionality', estimate: 4, rate: 100, due: '07/04/2007' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 121, description: 'Default CSS Styling', estimate: 2, rate: 100, due: '07/05/2007' }, { projectId: 101, project: 'Ext Grid: Single-level Grouping', taskId: 104, description: 'Testing and debugging', estimate: 6, rate: 100, due: '07/06/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 105, description: 'Ext Grid plugin integration', estimate: 4, rate: 125, due: '07/01/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 106, description: 'Summary creation during rendering phase', estimate: 4, rate: 125, due: '07/02/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 107, description: 'Dynamic summary updates in editor grids', estimate: 6, rate: 125, due: '07/05/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 108, description: 'Remote summary integration', estimate: 4, rate: 125, due: '07/05/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 109, description: 'Summary renderers and calculators', estimate: 4, rate: 125, due: '07/06/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 110, description: 'Integrate summaries with GroupingView', estimate: 10, rate: 125, due: '07/11/2007' }, { projectId: 102, project: 'Ext Grid: Summary Rows', taskId: 111, description: 'Testing and debugging', estimate: 8, rate: 125, due: '07/15/2007' } ];
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.XmlGridScript

SampleScripts.grid.XmlGridScript = function SampleScripts_grid_XmlGridScript() {
}
SampleScripts.grid.XmlGridScript.main = function SampleScripts_grid_XmlGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.XmlGridScript().init();
    }));
}
SampleScripts.grid.XmlGridScript.prototype = {
    
    init: function SampleScripts_grid_XmlGridScript$init() {
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().url('sheldon.xml').reader(new Ext.data.XmlReader(new Ext.data.XmlReaderConfig().record('Item').id('ASIN').totalRecords('@total').toDictionary(), [ { name: 'Author', mapping: 'ItemAttributes > Author' }, 'Title', 'Manufacturer', 'ProductGroup' ])).toDictionary());
        var cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().header('Author').width(120).dataIndex('Author').toDictionary(), new Ext.grid.ColumnModelConfig().header('Title').width(180).dataIndex('Title').toDictionary(), new Ext.grid.ColumnModelConfig().header('Manufacturer').width(115).dataIndex('Manufacturer').toDictionary(), new Ext.grid.ColumnModelConfig().header('Product Group').width(100).dataIndex('ProductGroup').toDictionary() ]);
        cm.defaultSortable = true;
        var grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().ds(ds).cm(cm).renderTo('example-grid').width(540).height(200).toDictionary());
        ds.load();
    }
}


Type.createNamespace('SampleScripts.messagebox');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.messagebox.MessageBoxScript

SampleScripts.messagebox.MessageBoxScript = function SampleScripts_messagebox_MessageBoxScript() {
}
SampleScripts.messagebox.MessageBoxScript.main = function SampleScripts_messagebox_MessageBoxScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.messagebox.MessageBoxScript().init();
    }));
}
SampleScripts.messagebox.MessageBoxScript._showResult = function SampleScripts_messagebox_MessageBoxScript$_showResult(btn, text) {
    Ext.MessageBox.alert('Button Click', String.format('You clicked the {0} button', btn));
}
SampleScripts.messagebox.MessageBoxScript._showResultText = function SampleScripts_messagebox_MessageBoxScript$_showResultText(btn, text) {
    Ext.MessageBox.alert('Button Click', String.format('You clicked the {0} button and entered the text \"{1}\".', btn, text));
}
SampleScripts.messagebox.MessageBoxScript._getProgressFunc = function SampleScripts_messagebox_MessageBoxScript$_getProgressFunc(i) {
    return Delegate.create(null, function() {
        if (i === 12) {
            Ext.MessageBox.hide();
            Ext.MessageBox.alert('Done', 'Your fake items were loaded!');
        }
        else {
            var v = i / 11;
            Ext.MessageBox.updateProgress(v, Math.round(100 * v) + '% completed');
        }
    });
}
SampleScripts.messagebox.MessageBoxScript.prototype = {
    
    init: function SampleScripts_messagebox_MessageBoxScript$init() {
        ExtClass.get('mb1').on('click', Delegate.create(this, function() {
            Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', Delegate.create(null, SampleScripts.messagebox.MessageBoxScript._showResult));
        }));
        ExtClass.get('mb2').on('click', Delegate.create(this, function() {
            Ext.MessageBox.prompt('Name', 'Please enter your name:', Delegate.create(null, SampleScripts.messagebox.MessageBoxScript._showResultText));
        }));
        ExtClass.get('mb3').on('click', Delegate.create(this, function() {
            Ext.MessageBox.show({ title: 'Address', msg: 'Please enter your address:', width: 300, buttons: Ext.MessageBox.OKCANCEL, multiline: true, fn: Delegate.create(null, SampleScripts.messagebox.MessageBoxScript._showResultText), animEl: 'mb3' });
        }));
        ExtClass.get('mb4').on('click', Delegate.create(this, function() {
            Ext.MessageBox.show({ title: 'Save Changes?', msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?', buttons: Ext.MessageBox.YESNOCANCEL, fn: Delegate.create(null, SampleScripts.messagebox.MessageBoxScript._showResult), animEl: 'mb4', icon: Ext.MessageBox.QUESTION });
        }));
        ExtClass.get('mb6').on('click', Delegate.create(this, function() {
            Ext.MessageBox.show({ title: 'Please wait', msg: 'Loading items...', progressText: 'Initializing...', width: 300, progress: true, closable: false, animEl: 'mb6' });
            for (var i = 1; i < 13; i++) {
                window.setTimeout(SampleScripts.messagebox.MessageBoxScript._getProgressFunc(i), i * 500);
            }
        }));
        ExtClass.get('mb7').on('click', Delegate.create(this, function() {
            Ext.MessageBox.show({ msg: 'Saving your data, please wait...', progressText: 'Saving...', width: 300, wait: true, waitConfig: { interval: 200 }, icon: 'ext-mb-download', animEl: 'mb7' });
            window.setTimeout(Delegate.create(this, function() {
                Ext.MessageBox.hide();
                Ext.MessageBox.alert('Done', 'Your fake data was saved!');
            }), 8000);
        }));
        ExtClass.get('mb8').on('click', Delegate.create(this, function() {
            Ext.MessageBox.alert('Status', 'Changes saved successfully.', Delegate.create(null, SampleScripts.messagebox.MessageBoxScript._showResult));
        }));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -