1.0 grouping store

Page 1 of 2 12 LastLast
  1. #1

    1.0 grouping store

    i have a grouping store but again the generated code have a script error

    ,loadexception:{fn:function(store,options,response ,e){hideMaskOverWindow('My', 'Loading...'); HRCA_ShowError('Error', 'Loading Error');}}}})extstorePQS.proxy=new Ext.data.PagingMemoryProxy(extsto

    again no ";" after the store config
  2. #2

    RE: 1.0 grouping store

    here is the complete generated script of the grouping store

    new Ext.ux.MultiGroupingStore({id:"extstorePQS",autoLoad:true,reader:new Ext.data.JsonReader({fields:[{name:"id"},{name:"content"},{name:"description"},{name:"checkedoutby"},{name:"checkedoutdate"},{name:"LastName"},{name:"FirstName"},{name:"arearevision"},{name:"areaid"},{name:"arearid"},{name:"qid_aid"},{name:"areaname",sortType:"asFloat",sortDir:"ASC"},{name:"areatag"},{name:"createdby"},{name:"QScreatedby"},{name:"QSuserrole"},{name:"areaquestioncount"},{name:"area_display_order",sortType:"asFloat",sortDir:"ASC"},{name:"qtags"},{name:"publishStatus"},{name:"areagroupquestioncount"},{name:"areadesc"},{name:"deptdesc"}],idProperty:"qid_aid"}),sortInfo:{field:"area_display_order",direction:"asc"},directEventConfig:{formProxyArg:"form1"},listeners:{datachanged:{delay:50,fn:function(store){if (Ext.isGecko) adjustGridScroll(extgpMyQS); }},load:{fn:function(store,records,options){extgpMyQS.getView().suspendEvents(); if (!extcomboViewby || extcomboViewby.getValue() == '' || extcomboViewby.getValue() == '3') { extgpMyQS.store.groupBy('area_display_order', true); extgpMyQS.store.groupBy('areaname'); } else { extgpMyQS.store.groupBy('area_display_order', true); extgpMyQS.getColumnModel().setHidden(extgpMyQS.getColumnModel().getColumnCount(false) - 3, true); } extgpMyQS.getView().resumeEvents(); hideMaskOverWindow('My', 'Loading...'); }},loadexception:{fn:function(store,options,response,e){hideMaskOverWindow('My', 'Loading...'); HRCA_ShowError('Error', 'Loading Error');}}}})  <-=-- again no semi colon generated after the code
    the multigrouping store is a store extension which i have been using since 0.82 version


    this is my js code for the multigrouping store


    
    Ext.ux.MultiGroupingStore = Ext.extend(Ext.net.Store, {
        constructor: function(config){Ext.ux.MultiGroupingStore.superclass.constructor.apply(this, arguments);},
        sortInfo: [],
        sort: function(field, dir){
            var f = [];
            if (!field) {return false;}
            if (Ext.isArray(field)) {for (var i = 0, len = field.length; i < len; ++i) {f.push(this.fields.get(field[i]));}} 
            else {f.push(this.fields.get(field));}
            if (f.length < 1) {return false;}
            if (!dir) {
                if (this.sortInfo &amp;&amp; this.sortInfo.length > 0 &amp;&amp; this.sortInfo[0].field == f[0].name)
                {
                    // toggle sort direction
                    dir = (this.sortToggle[f[0].name] || "ASC").toggle("ASC", "DESC");
                }
                else
                    dir = f[0].sortDir;
            }
            var st = (this.sortToggle) ? this.sortToggle[f[0].name] : null;
            var si = (this.sortInfo) ? this.sortInfo : null;
            this.sortToggle[f[0].name] = dir;
            this.sortInfo = [];
            for (i=0, len=f.length; i < len; ++i) {
                this.sortInfo.push({field: f[i].name,direction: dir});
            }
            if (!this.remoteSort) {
                this.applySort();
                this.fireEvent("datachanged", this);
            } 
            else {
                if (!this.load(this.lastOptions)){
                    if (st){this.sortToggle[f[0].name] = st;}
                    if (si){this.sortInfo = si;}
                }
            }
            return true;
        },
        setDefaultSort: function (field, dir){
            dir = dir ? dir.toUpperCase() : "ASC";
            this.sortInfo = [];
            if (!Ext.isArray(field)){this.sortInfo.push({field: field, direction: dir});}
            else {
                for (var i = 0, len = field.length; i < len; ++i) {
                    this.sortInfo.push({field: field[i].field,direction: dir});
                    this.sortToggle[field[i]] = dir;
                }
            }
        },
        groupBy: function (field, forceRegroup){
            if (!forceRegroup &amp;&amp; this.groupField == field)
                return; // already grouped by this field
            if (!forceRegroup &amp;&amp; this.groupField)    //when we do forceRegroup, we remove all groups then add new set of groupings, that's forceregroup
            {
                if (this.groupField.indexOf(field) > -1) {
                    return;
                }
                this.groupField.push(field);
            }
            else {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);
            }
        },
        applySort: function (){
            var si = this.sortInfo;
            if (si &amp;&amp; si.length > 0 &amp;&amp; !this.remoteSort) {this.sortData(si, si[0].direction); }
            if (!this.groupOnSort &amp;&amp; !this.remoteGroup) {
                var gs = this.getGroupState();
                if (gs &amp;&amp; gs != this.sortInfo) {this.sortData(this.groupField);}
            }
        },
        getGroupState: function (){
            return this.groupOnSort &amp;&amp; this.groupField !== false ? (this.sortInfo ? this.sortInfo : undefined) : this.groupField;
        },
        sortData: function (flist, direction){
            direction = direction || 'ASC';
            var st = [];
            var o;
            for (var i = 0, len = flist.length; i < len; ++i) {
                o = flist[i];
                st.push(this.fields.get(o.field ? o.field : o).sortType);
            }
            var fn = function (r1, r2){
                var v1 = [];
                var v2 = [];
                var len = flist.length;
                var o;
                var name;
                for (i = 0; i < len; ++i) {
                    o = flist[i];
                    name = o.field ? o.field : o;
                    v1.push(st[i](r1.data[name]));
                    v2.push(st[i](r2.data[name]));
                }
                var result;
                for (i = 0; i < len; ++i) {
                    result = v1[i] > v2[i] ? 1 : (v1[i] < v2[i] ? -1 : 0);
                    if (result !== 0){return result;}
                }
                return result; // if it gets here, that means all fields are equal
            };
            this.data.sort(direction, fn);
            if (this.snapshot &amp;&amp; this.snapshot != this.data) {this.snapshot.sort(direction, fn);}
        }
    });
  3. #3

    RE: 1.0 grouping store

    Hi,

    Please provide full test sample
  4. #4

    RE: 1.0 grouping store

    can i just email you the aspx page with the store extension full source code?
  5. #5

    RE: 1.0 grouping store

    here is the multigrouping.cs

    
    /********
     * @version   : 0.8.2 - Professional Edition (Coolite Professional License)
     * @author    : Coolite Inc. http://www.ext.net/
     * @date      : 2009-08-05
     * @copyright : Copyright (c) 2006-2009, Coolite Inc. (http://www.ext.net/). All rights reserved.
     * @license   : See license.txt and http://www.ext.net/license/. 
     ********/
    
    
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Web.UI;
    using System.Collections;
    using System.Xml;
    using System.Collections.Specialized;
    using System.Web;
    using System.Web.UI.WebControls;
    using Ext.Net.Utilities;
    using Newtonsoft.Json;
    using System.IO;
    
    namespace Ext.Net
    {
        [Designer(typeof(EmptyDesigner))]
        public class MultiGroupingStore : Store, IPostBackEventHandler, ICustomConfigSerialization
        {
            protected override List<ResourceItem> Resources
            {
                get
                {
                    List<ResourceItem> baseList = base.Resources;
                    baseList.Capacity += 1;
    
                    baseList.Add(new ClientScriptItem(typeof(MultiGroupingStore), "Ext.Net.Build.Resources.Ext.Net.ux.extensions.multigrouping.multigrouping.js", "/ux/extensions/multigrouping/multigrouping.js"));
    
                    return baseList;
                }
            }
    
            public override string XType
            {
                get
                {
                    return "multigroupstore";
                }
            }
    
            [Category("0. About")]
            public override string InstanceOf
            {
                get
                {
                    return "Ext.ux.MultiGroupingStore";
                }
            }
    
            /// <summary>
            /// The field name by which to sort the store's data (defaults to '').
            /// </summary>
            [ConfigOption("groupField", typeof(StringArrayJsonConverter))]
            [TypeConverter(typeof(StringArrayConverter))]
            [Category("Config Options")]
            [DefaultValue(null)]
            [Description("The field name by which to sort the store's data (defaults to '').")]
            public virtual string[] GroupFieldArray
            {
                get
                {
                    object obj = this.ViewState["GroupFieldArray"];
                    string[] groupfields = (obj == null) ? null : (string[])obj;
                    return groupfields;
                }
                set
                {
                    this.ViewState["GroupFieldArray"] = value;
                }
            }
    
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
    
                if (!this.DesignMode &amp;&amp; !this.IsLazy)
                {
                    this.Page.LoadComplete += Page_LoadComplete;
                }
            }
    
            protected internal override bool IsIdRequired
            {
                get
                {
                    return true;
                }
            }
    
            void Page_LoadComplete(object sender, EventArgs e)
            {
                if (this.ParentComponent == null || (RequestManager.IsMicrosoftAjaxRequest &amp;&amp; !this.IsInUpdatePanelRefresh))
                {
                    return;
                }
    
                Component parent = this.ParentComponent;
    
                if (parent != null)
                {
                    parent = this.ParentComponent;
                    while (parent != null &amp;&amp; (parent.IsLazy || parent.IsLayout))
                    {
                        parent = parent.ParentComponent;
                    }
                }
    
    
                if (parent != null)
                {
                    parent.BeforeClientInit += Parent_BeforeClientInit;
                }
            }
    
            void Parent_BeforeClientInit(Observable sender)
            {
                this.ForcePreRender();
            }
    
            internal override void ForcePreRender()
            {
                if (!RequestManager.IsAjaxRequest)
                {
                    this.EnsureDataBound();
                    base.ForcePreRender();
                }
            }
    
            private bool MemoryDataPresent
            {
                get { return this.Reader != null &amp;&amp; this.Reader.Reader != null &amp;&amp; (this.Data != null || this.JsonData.IsNotEmpty()); }
            }
    
            private string BuildParams(ParameterCollection parameters)
            {
                StringBuilder sb = new StringBuilder("function(store,options){if (!options.params){options.params = {};};");
    
                sb.AppendFormat("Ext.apply(options.params,{0});", parameters.ToJson(2));
                sb.AppendFormat("Ext.applyIf(options.params,{0});", parameters.ToJson(1));
                sb.Append("}");
    
                return sb.ToString();
            }
    
            private IDictionary keys;
            private IDictionary values;
            private IDictionary oldValues;
            private bool needRetrieve;
            private ConfirmationRecord confirmation;
            private XmlNode record;
    
            void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
            {
                if (RequestManager.IsAjaxRequest)
                {
                    if (eventArgument.IsEmpty())
                    {
                        return;
                    }
                    this.RaiseAjaxPostBackEvent(eventArgument);
                    return;
                }
            }
    
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
    
                if (RequestManager.IsAjaxRequest &amp;&amp; this.ParentForm == null)
                {
                    this.Page.LoadComplete += new EventHandler(Store_LoadComplete);
                }
            }
    
            private void Store_LoadComplete(object sender, EventArgs e)
            {
                if (this.IsDynamic)
                {
                    return;
                }
    
                if (this.Page == null)
                {
                    return;
                }
    
                string _ea = this.Page.Request["__EVENTARGUMENT"];
    
                if (_ea.IsNotEmpty())
                {
                    string _et = this.Page.Request["__EVENTTARGET"];
    
                    if (_et == this.UniqueID)
                    {
                        RaiseAjaxPostBackEvent(_ea);
                    }
    
                    return;
                }
    
                if (this.SubmitConfig == null)
                {
                    return;
                }
    
                XmlNode eventArgumentNode = this.SubmitConfig.SelectSingleNode("config/__EVENTARGUMENT");
    
                if (eventArgumentNode == null)
                {
                    throw new InvalidOperationException(
                        "Incorrect submit config - the '__EVENTARGUMENT' parameter is absent");
                }
    
                XmlNode eventTargetNode = this.SubmitConfig.SelectSingleNode("config/__EVENTTARGET");
    
                if (eventTargetNode == null)
                {
                    throw new InvalidOperationException(
                        "Incorrect submit config - the '__EVENTTARGET' parameter is absent");
                }
    
                if (eventTargetNode.InnerText == this.UniqueID)
                {
                    RaiseAjaxPostBackEvent(eventArgumentNode.InnerText);
                }
            }
    
            private BeforeStoreChangedEventArgs changingEventArgs;
            private void DoSaving(string jsonData, XmlNode callbackParameters)
            {
                changingEventArgs = new BeforeStoreChangedEventArgs(jsonData, null, callbackParameters);
    
                ConfirmationList confirmationList = null;
    
                if (this.UseIdConfirmation &amp;&amp; this.Reader.Reader != null)
                {
                    confirmationList = changingEventArgs.DataHandler.BuildConfirmationList(GetIdColumnName());
                }
    
                changingEventArgs.ConfirmationList = confirmationList;
    
                this.OnBeforeStoreChanged(changingEventArgs);
    
                Exception ex = null;
                try
                {
                    if (!changingEventArgs.Cancel)
                    {
                        this.MakeChanges();
                    }
                }
                catch (Exception e)
                {
                    ex = e;
                }
    
                AfterStoreChangedEventArgs eStoreChanged = new AfterStoreChangedEventArgs(true, ex, confirmationList);
                this.OnAfterStoreChanged(eStoreChanged);
    
                if (eStoreChanged.Exception != null &amp;&amp; !eStoreChanged.ExceptionHandled)
                {
                    throw new Exception(ex.Message, ex);
                }
            }
    
            private void MakeChanges()
            {
                bool noDs = this.DataSourceID.IsEmpty();
                IDataSource ds = null;
    
                if (!noDs)
                {
                    ds = this.GetDataSource();
                }
    
                if (ds == null &amp;&amp; !noDs)
                {
                    throw new HttpException("Can't find DataSource");
                }
    
                if (this.Reader.Reader == null)
                {
                    throw new InvalidOperationException("The Store does not contain a Reader.");
                }
    
                XmlDocument xml = changingEventArgs.DataHandler.XmlData;
    
                if (noDs || ds.GetView("").CanUpdate)
                {
                    this.MakeUpdates(ds, xml);
                }
                if (noDs || ds.GetView("").CanDelete)
                {
                    this.MakeDeletes(ds, xml);
                }
                if (noDs || ds.GetView("").CanInsert)
                {
                    this.MakeInsertes(ds, xml);
                }
            }
    
            private string GetIdColumnName()
            {
                string id = "";
    
                if (this.Reader.Reader != null)
                {
                    id = this.Reader.Reader.IDField;
                }
    
                return id;
            }
    
            private void MakeUpdates(IDataSource ds, XmlDocument xml)
            {
                XmlNodeList updatingRecords = xml.SelectNodes("records/Updated/record");
    
                string id = GetIdColumnName();
    
                foreach (XmlNode node in updatingRecords)
                {
                    record = node;
                    values = new SortedList(this.Reader.Reader.Fields.Count);
                    keys = new SortedList();
                    oldValues = new SortedList();
    
                    foreach (RecordField field in this.Reader.Reader.Fields)
                    {
                        XmlNode keyNode = node.SelectSingleNode(field.Name);
                        values[field.Name] = keyNode != null ? keyNode.InnerText : null;
                    }
    
                    confirmation = null;
    
                    if (id.IsNotEmpty())
                    {
                        XmlNode keyNode = node.SelectSingleNode(id);
                        string idStr = keyNode != null ? keyNode.InnerText : null;
    
                        int idInt;
                        if (int.TryParse(idStr, out idInt))
                        {
                            keys[id] = idInt;
                        }
                        else
                        {
                            keys[id] = idStr;
                        }
    
                        if (this.UseIdConfirmation &amp;&amp; keys[id] != null)
                        {
                            confirmation = changingEventArgs.ConfirmationList[keys[id].ToString()];
                        }
                    }
    
                    BeforeRecordUpdatedEventArgs eBeforeRecordUpdated = new BeforeRecordUpdatedEventArgs(record, keys, values, oldValues, confirmation);
                    this.OnBeforeRecordUpdated(eBeforeRecordUpdated);
    
                    if (eBeforeRecordUpdated.CancelAll)
                    {
                        break;
                    }
                    if (eBeforeRecordUpdated.Cancel)
                    {
                        continue;
                    }
                    if (ds != null)
                    {
                        ds.GetView("").Update(keys, values, oldValues, this.UpdateCallback);
                    }
                    else
                    {
                        this.UpdateCallback(0, null);
                    }
    
                }
            }
    
            private void MakeDeletes(IDataSource ds, XmlDocument xml)
            {
                XmlNodeList deletingRecords = xml.SelectNodes("records/Deleted/record");
                string id = GetIdColumnName();
                foreach (XmlNode node in deletingRecords)
                {
                    record = node;
                    values = new SortedList(0);
                    keys = new SortedList();
                    oldValues = new SortedList(0);
    
                    confirmation = null;
    
                    if (id.IsNotEmpty())
                    {
                        XmlNode keyNode = node.SelectSingleNode(id);
                        string idStr = keyNode != null ? keyNode.InnerText : null;
    
                        int idInt;
                        if (int.TryParse(idStr, out idInt))
                        {
                            keys[id] = idInt;
                        }
                        else
                        {
                            keys[id] = idStr;
                        }
    
                        if (this.UseIdConfirmation &amp;&amp; keys[id] != null)
                        {
                            confirmation = changingEventArgs.ConfirmationList[keys[id].ToString()];
                        }
                    }
    
                    BeforeRecordDeletedEventArgs eBeforeRecordDeleted = new BeforeRecordDeletedEventArgs(record, keys, confirmation);
                    this.OnBeforeRecordDeleted(eBeforeRecordDeleted);
    
                    if (eBeforeRecordDeleted.CancelAll)
                    {
                        break;
                    }
                    if (eBeforeRecordDeleted.Cancel)
                    {
                        continue;
                    }
    
                    if (ds != null)
                    {
                        ds.GetView("").Delete(keys, oldValues, DeleteCallback);
                    }
                    else
                    {
                        this.DeleteCallback(0, null);
                    }
                }
    
                if (deletingRecords.Count > 0)
                {
                    needRetrieve = true;
                }
            }
    
            private void MakeInsertes(IDataSource ds, XmlDocument xml)
            {
                XmlNodeList insertingRecords = xml.SelectNodes("records/Created/record");
                string id = GetIdColumnName();
                foreach (XmlNode node in insertingRecords)
                {
                    record = node;
                    values = new SortedList(this.Reader.Reader.Fields.Count);
                    keys = new SortedList();
                    oldValues = new SortedList();
    
                    foreach (RecordField field in this.Reader.Reader.Fields)
                    {
                        XmlNode keyNode = node.SelectSingleNode(field.Name);
                        values[field.Name] = keyNode != null ? keyNode.InnerText : null;
                    }
    
                    confirmation = null;
    
                    if (id.IsNotEmpty())
                    {
                        XmlNode keyNode = node.SelectSingleNode(id);
    
                        if (this.UseIdConfirmation &amp;&amp; keyNode != null &amp;&amp; keyNode.InnerText.IsNotEmpty())
                        {
                            confirmation = changingEventArgs.ConfirmationList[keyNode.InnerText];
                        }
                    }
    
                    BeforeRecordInsertedEventArgs eBeforeRecordInserted = new BeforeRecordInsertedEventArgs(record, keys, values, confirmation);
                    this.OnBeforeRecordInserted(eBeforeRecordInserted);
    
                    if (eBeforeRecordInserted.CancelAll)
                    {
                        break;
                    }
    
                    if (eBeforeRecordInserted.Cancel)
                    {
                        continue;
                    }
    
                    if (ds != null)
                    {
                        ds.GetView("").Insert(values, InsertCallback);
                    }
                    else
                    {
                        this.InsertCallback(0, null);
                    }
                }
    
                if (insertingRecords.Count > 0)
                {
                    needRetrieve = true;
                }
            }
    
            bool UpdateCallback(int recordsAffected, Exception exception)
            {
                if (confirmation != null &amp;&amp; recordsAffected > 0)
                {
                    confirmation.ConfirmRecord();
                }
                AfterRecordUpdatedEventArgs eAfterRecordUpdated = new AfterRecordUpdatedEventArgs(record, recordsAffected, exception, keys, values, oldValues, confirmation);
                this.OnAfterRecordUpdated(eAfterRecordUpdated);
    
                return eAfterRecordUpdated.ExceptionHandled;
            }
    
            bool DeleteCallback(int recordsAffected, Exception exception)
            {
                if (confirmation != null &amp;&amp; recordsAffected > 0)
                {
                    confirmation.ConfirmRecord();
                }
                AfterRecordDeletedEventArgs eAfterRecordDeleted = new AfterRecordDeletedEventArgs(record, recordsAffected, exception, keys, confirmation);
                this.OnAfterRecordDeleted(eAfterRecordDeleted);
    
                return eAfterRecordDeleted.ExceptionHandled;
            }
    
            bool InsertCallback(int recordsAffected, Exception exception)
            {
                if (confirmation != null &amp;&amp; recordsAffected > 0)
                {
                    confirmation.ConfirmRecord();
                }
    
                AfterRecordInsertedEventArgs eAfterRecordInserted = new AfterRecordInsertedEventArgs(record, recordsAffected, exception, keys, values, confirmation);
                this.OnAfterRecordInserted(eAfterRecordInserted);
    
                return eAfterRecordInserted.ExceptionHandled;
            }
    
    
            /*  ------------------------------------------------------------------------------------------*/
    
            private bool success = true;
            private string msg;
    
            private void RaiseAjaxPostBackEvent(string eventArgument)
            {
                bool needConfirmation = false;
                try
                {
                    if (eventArgument.IsEmpty())
                    {
                        throw new ArgumentNullException("eventArgument");
                    }
    
                    XmlNode xmlData = this.SubmitConfig;
                    string data = null;
                    XmlNode parametersNode = null;
    
                    if (xmlData != null)
                    {
                        parametersNode = xmlData.SelectSingleNode("config/extraParams");
    
                        XmlNode serviceNode = xmlData.SelectSingleNode("config/serviceParams");
                        if (serviceNode != null)
                        {
                            data = serviceNode.InnerText;
                        }
                    }
    
                    string action = eventArgument;
    
                    BeforeDirectEventArgs e = new BeforeDirectEventArgs(action, data, parametersNode);
                    this.OnAjaxPostBack(e);
                    PageProxy dsp = this.Proxy.Proxy as PageProxy;
    
                    if (this.AutoDecode &amp;&amp; data.IsNotEmpty())
                    {
                        data = HttpUtility.HtmlDecode(data);
                    }
    
                    switch (action)
                    {
                        case "update":
                            if (data == null)
                            {
                                throw new InvalidOperationException("No data in request");
                            }
    
                            needConfirmation = this.UseIdConfirmation;
                            this.DoSaving(data, parametersNode);
    
                            if (this.RefreshAfterSaving == RefreshAfterSavingMode.None || dsp != null)
                            {
                                needRetrieve = false;
                            }
    
                            break;
                        case "refresh":
                            needRetrieve = true;
                            StoreRefreshDataEventArgs refreshArgs = new StoreRefreshDataEventArgs(parametersNode);
                            this.OnRefreshData(refreshArgs);
    
                            if (dsp != null)
                            {
                                if (refreshArgs.Total > -1)
                                {
                                    dsp.Total = refreshArgs.Total;
                                }
                            }
    
                            break;
                        case "submit":
                            needRetrieve = false;
    
                            if (data == null)
                            {
                                throw new InvalidOperationException("No data in request");
                            }
    
                            StoreSubmitDataEventArgs args = new StoreSubmitDataEventArgs(data, parametersNode);
                            this.OnSubmitData(args);
    
                            break;
                    }
                }
                catch (Exception ex)
                {
                    success = false;
                    msg = this.IsDebugging ? ex.ToString() : ex.Message;
                    if (this.ResourceManager.RethrowAjaxExceptions)
                    {
                        throw;
                    }
                }
    
                AfterDirectEventArgs eAjaxPostBackResult = new AfterDirectEventArgs(new Response(success, msg));
                this.OnAjaxPostBackResult(eAjaxPostBackResult);
    
                StoreResponseData response = new StoreResponseData();
    
                if (needRetrieve &amp;&amp; eAjaxPostBackResult.Response.Success)
                {
                    if (this.RequiresDataBinding)
                    {
                        this.DataBind();
                    }
    
                    response.Data = this.Data != null ? JSON.Serialize(this.Data) : this.JsonData;
                    PageProxy dsp = this.Proxy.Proxy as PageProxy;
                    response.Total = dsp != null ? dsp.Total : 0;
                }
    
                if (needConfirmation)
                {
                    response.Confirmation = changingEventArgs.ConfirmationList;
                }
    
                eAjaxPostBackResult.Response.Data = response.ToString();
    
                ResourceManager.ServiceResponse = eAjaxPostBackResult.Response;
            }
    
            public string ToScript(Control owner)
            {
                return "new Ext.ux.MultiGroupingStore(".ConcatWith(new ClientConfig().Serialize(this, true), ")");
            }
        }
    
        [Designer(typeof(EmptyDesigner))]
        public class MultiGroupingView : GroupingView
        {
            protected override List<ResourceItem> Resources
            {
                get
                {
                    List<ResourceItem> baseList = base.Resources;
                    baseList.Capacity += 1;
    
                    baseList.Add(new ClientScriptItem(typeof(MultiGroupingView), "Ext.Net.Build.Resources.Ext.Net.ux.extensions.multigrouping.multigrouping.js", "/ux/extensions/multigrouping/multigrouping.js"));
    
                    return baseList;
                }
            }
    
            public override string XType
            {
                get
                {
                    return "multigroupview";
                }
            }    
    
            public override string InstanceOf
            {
                get
                {
                    return "Ext.ux.MultiGroupingView";
                }
            }
        }
    
        [Designer(typeof(EmptyDesigner))]
        public class MultiGroupingPanel : GridPanel
        {
            protected override List<ResourceItem> Resources
            {
                get
                {
                    List<ResourceItem> baseList = base.Resources;
                    baseList.Capacity += 1;
    
                    baseList.Add(new ClientScriptItem(typeof(MultiGroupingPanel), "Ext.Net.Build.Resources.Ext.Net.ux.extensions.multigrouping.multigrouping.js", "/ux/extensions/multigrouping/multigrouping.js"));
    
                    return baseList;
                }
            }
    
            public override string XType
            {
                get
                {
                    return "multigroupgridpanel";
                }
            }    
    
            public override string InstanceOf
            {
                get
                {
                    return "Ext.ux.MultiGroupingPanel";
                }
            }
    
            protected override void OnBeforeClientInit(Observable sender)
            {
                base.OnBeforeClientInit(sender);
    
                this.CheckColumns();
    
                if (this.SelectionMemoryProxy &amp;&amp; this.MemoryIDField.IsEmpty() &amp;&amp; this.StoreID.IsNotEmpty())
                {
                    Store store = ControlUtils.FindControl(this, this.StoreID) as Store;
    
                    if (store != null &amp;&amp; store.Reader.Count > 0)
                    {
                        string id = store.Reader.Reader.IDField;
    
                        if (id.IsNotEmpty())
                        {
                            this.MemoryIDField = id;
                        }
                    }
                }
            }
    
            //public void RegisterColumnPlugins()
            //{
            //    Ext.EnsureAjaxEvent();
            //    this.AddScript("{0}.initColumnPlugins({1}, true);", this.ClientID, this.GetColumnPlugins());
            //}
    
            private void CheckColumns()
            {
                string plugins = this.GetColumnPlugins();
    
                if (plugins.Length > 2)
                {
                    this.CustomConfig.Add(new ConfigItem("columnPlugins", plugins, ParameterMode.Raw));
                }
            }
    
            private string GetColumnPlugins()
            {
                StringBuilder sb = new StringBuilder("[");
                for (int i = 0; i < this.ColumnModel.Columns.Count; i++)
                {
                    CommandColumn cmdCol = this.ColumnModel.Columns[i] as CommandColumn;
                    ImageCommandColumn imgCmdCol = this.ColumnModel.Columns[i] as ImageCommandColumn;
                    Column column = this.ColumnModel.Columns[i] as Column;
    
                    if (column != null &amp;&amp; column.Commands.Count > 0 &amp;&amp; imgCmdCol == null)
                    {
                        this.ResourceManager.RegisterClientStyleInclude("Ext.Net.Build.Resources.Ext.Net.ux.plugins.commandcolumn.commandcolumn.css");
                        continue;
                    }
    
                    if (cmdCol != null || imgCmdCol != null)
                    {
                        sb.Append(i + ",");
                        this.ResourceManager.RegisterClientStyleInclude("Ext.Net.Build.Resources.Ext.Net.ux.plugins.commandcolumn.commandcolumn.css");
                        continue;
                    }
    
                    CheckColumn cc = this.ColumnModel.Columns[i] as CheckColumn;
    
                    if (cc != null &amp;&amp; cc.Editable)
                    {
                        sb.Append(i + ",");
                        continue;
                    }
                }
    
                if (sb[sb.Length - 1] == ',')
                {
                    sb.Remove(sb.Length - 1, 1);
                }
    
                sb.Append("]");
    
                return sb.ToString();
            }
    
            protected override void OnAfterClientInit(Observable sender)
            {
                base.OnAfterClientInit(sender);
    
                this.CheckAutoExpand();
            }
    
            protected virtual void CheckAutoExpand()
            {
                if (this.AutoExpandColumn.IsNotEmpty())
                {
                    if (this.AutoExpandColumn.Test("^\\d+$"))
                    {
                        return;
                    }
    
                    bool found = false;
    
                    foreach (ColumnBase column in this.ColumnModel.Columns)
                    {
                        if (column.ColumnID == this.AutoExpandColumn)
                        {
                            found = true;
                            break;
                        }
                    }
    
                    if (!found)
                    {
                        throw new ArgumentException("The auto expand Column with ID='".ConcatWith(this.AutoExpandColumn, "' is not found!"));
                    }
                }
            }
    
            //private GridPanelListeners listeners;
    
            /// <summary>
            /// Client-side JavaScript EventHandlers
            /// </summary>
            //[ClientConfig("listeners", JsonMode.Object)]
            //[Category("Events")]
            //[Themeable(false)]
            //[NotifyParentProperty(true)]
            //[PersistenceMode(PersistenceMode.InnerProperty)]
            //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            //[Description("Client-side JavaScript EventHandlers")]
            //[ViewStateMember]
            //public GridPanelListeners Listeners
            //{
            //    get
            //    {
            //        if (this.listeners == null)
            //        {
            //            this.listeners = new GridPanelListeners();
            //            this.listeners.InitOwners(this);
            //        }
            //        return this.listeners;
            //    }
            //}
    
            //private GridPanelAjaxEvents ajaxEvents;
    
            /// <summary>
            /// Server-side Ajax EventHandlers
            /// </summary>
            //[Category("Events")]
            //[Themeable(false)]
            //[NotifyParentProperty(true)]
            //[PersistenceMode(PersistenceMode.InnerProperty)]
            //[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            //[Description("Server-side Ajax EventHandlers")]
            //[ViewStateMember]
            //public GridPanelAjaxEvents AjaxEvents
            //{
            //    get
            //    {
            //        if (this.ajaxEvents == null)
            //        {
            //            this.ajaxEvents = new GridPanelAjaxEvents();
            //            this.ajaxEvents.InitOwners(this);
    
            //            if (this.IsTrackingViewState)
            //            {
            //                ((IStateManager)this.ajaxEvents).TrackViewState();
            //            }
            //        }
            //        return this.ajaxEvents;
            //    }
            //}
    
            protected override void PageLoadComplete(object sender, EventArgs e)
            {
                base.PageLoadComplete(sender, e);
    
                //Here is we must add view templates because LazyObservable incorrect hosts inner controls
                if (this.View.View != null)
                {
                    this.Controls.Add(this.View.View.Templates.Header);
                    this.LazyItems.Add(this.View.View.Templates.Header);
                }
            }
    
            protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
            {
                bool result = base.LoadPostData(postDataKey, postCollection);
                string val = postCollection[this.ClientID.ConcatWith("_SM")];
    
                if (val != null &amp;&amp; this.SelectionModel.Primary != null)
                {
                    JsonSerializer serializer = new JsonSerializer();
                    serializer.MissingMemberHandling = MissingMemberHandling.Ignore;
                    StringReader sr = new StringReader(val);
    
                    if (this.SelectionModel.Primary is RowSelectionModel)
                    {
                        SelectedRowCollection ids = (SelectedRowCollection)serializer.Deserialize(sr, typeof(SelectedRowCollection));
                        (this.SelectionModel.Primary as RowSelectionModel).SetSelection(ids);
                    }
                    else if (this.SelectionModel.Primary is CellSelectionModel)
                    {
                        SelectedCellSerializable cell = (SelectedCellSerializable)serializer.Deserialize(sr, typeof(SelectedCellSerializable));
    
                        if (cell != null)
                        {
                            CellSelectionModel sm = this.SelectionModel.Primary as CellSelectionModel;
                            sm.SelectedCell.RowIndex = cell.RowIndex;
                            sm.SelectedCell.ColIndex = cell.ColIndex;
                            sm.SelectedCell.RecordID = cell.RecordID;
                            sm.SelectedCell.Name = cell.Name;
                            sm.SelectedCell.Value = cell.Value;
                        }
                    }
                }
    
                return result;
            }
        }
    }
  6. #6

    RE: 1.0 grouping store

    i have managed to solve the semi colon problem now, but a new script error occured... Ext.ux.MultiGroupingStore is not a constructor
  7. #7

    RE: 1.0 grouping store

    please help it's really getting frustrating extending the store on v1.0 while it worked really fine in v0.82... i'm still getting the error Ext.ux.MultiGroupingStore is not a constructor... i'll email you the codes just tell me where to,,, thanks

    the javascript file doesn't seem to be getting included on the WebResource.axd hayyyy
  8. #8

    RE: 1.0 grouping store

    Hi,

    Are sure that you have correct web resource path? In last 1.0 version we change the path for extensions (now in the 'branches\1.0.0\Ext.Net\Build\Ext.Net\ux\extension s\')


    Do you mark it as EmbeddedResource? Do you assembly WebResource attribute (for example in the AssemblyInfo.cs)?
    If you try to open generated link on that resource (you can find it in generated source html) then what you see? Or try to see in FireBug console, what status of the request to that resource?
  9. #9

    RE: 1.0 grouping store

    has the grouping view's getGroupField() method been removed?
  10. #10

    RE: 1.0 grouping store

    Hi,

    No, it is still presenting
    getGroupField : function(){
            return this.grid.store.getGroupState();
        }
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 6
    Last Post: Oct 25, 2011, 3:02 PM
  2. [FIXED] [1.2] Grouping store error
    By softmachine2011 in forum Bugs
    Replies: 2
    Last Post: Sep 21, 2011, 11:37 AM
  3. [CLOSED] [1.0] Store sort and grouping
    By ljankowski in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 09, 2010, 1:17 PM
  4. [CLOSED] Multiple Grouping Field on a Grid's Store
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 04, 2009, 10:22 AM
  5. [CLOSED] Store grouping
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 03, 2009, 5:43 AM

Posting Permissions