X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/source/data/GroupingStore.js diff --git a/source/data/GroupingStore.js b/source/data/GroupingStore.js deleted file mode 100644 index d2fb1de7..00000000 --- a/source/data/GroupingStore.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Ext JS Library 2.2.1 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ - -/** - * @class Ext.data.GroupingStore - * @extends Ext.data.Store - * A specialized store implementation that provides for grouping records by one of the available fields. This - * is usually used in conjunction with an {@link Ext.grid.GroupingView} to proved the data model for - * a grouped GridPanel. - * @constructor - * Creates a new GroupingStore. - * @param {Object} config A config object containing the objects needed for the Store to access data, - * and read the data into Records. - */ -Ext.data.GroupingStore = Ext.extend(Ext.data.Store, { - /** - * @cfg {String} groupField - * The field name by which to sort the store's data (defaults to ''). - */ - /** - * @cfg {Boolean} remoteGroup - * True if the grouping should apply on the server side, false if it is local only (defaults to false). If the - * grouping is local, it can be applied immediately to the data. If it is remote, then it will simply act as a - * helper, automatically sending the grouping field name as the 'groupBy' param with each XHR call. - */ - remoteGroup : false, - /** - * @cfg {Boolean} groupOnSort - * True to sort the data on the grouping field when a grouping operation occurs, false to sort based on the - * existing sort info (defaults to false). - */ - groupOnSort:false, - - /** - * Clears any existing grouping and refreshes the data using the default sort. - */ - clearGrouping : function(){ - this.groupField = false; - if(this.remoteGroup){ - if(this.baseParams){ - delete this.baseParams.groupBy; - } - this.reload(); - }else{ - this.applySort(); - this.fireEvent('datachanged', this); - } - }, - - /** - * Groups the data by the specified field. - * @param {String} field The field name by which to sort the store's data - * @param {Boolean} forceRegroup (optional) True to force the group to be refreshed even if the field passed - * in is the same as the current grouping field, false to skip grouping on the same field (defaults to false) - */ - groupBy : function(field, forceRegroup){ - if(this.groupField == field && !forceRegroup){ - return; // already grouped by this field - } - this.groupField = field; - if(this.remoteGroup){ - if(!this.baseParams){ - this.baseParams = {}; - } - this.baseParams['groupBy'] = field; - } - if(this.groupOnSort){ - this.sort(field); - return; - } - if(this.remoteGroup){ - this.reload(); - }else{ - var si = this.sortInfo || {}; - if(si.field != field){ - this.applySort(); - }else{ - this.sortData(field); - } - this.fireEvent('datachanged', this); - } - }, - - // private - applySort : function(){ - Ext.data.GroupingStore.superclass.applySort.call(this); - if(!this.groupOnSort && !this.remoteGroup){ - var gs = this.getGroupState(); - if(gs && gs != this.sortInfo.field){ - this.sortData(this.groupField); - } - } - }, - - // private - applyGrouping : function(alwaysFireChange){ - if(this.groupField !== false){ - this.groupBy(this.groupField, true); - return true; - }else{ - if(alwaysFireChange === true){ - this.fireEvent('datachanged', this); - } - return false; - } - }, - - // private - getGroupState : function(){ - return this.groupOnSort && this.groupField !== false ? - (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField; - } -}); \ No newline at end of file