Results 1 to 2 of 2

Thread: grid grouping stateful collapse

  1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    212
    Answers
    3

    Default grid grouping stateful collapse

    Hi,

    i use the groupingsummary feature in my grid, works awesome...

    Code:
    features: [{
                id: 'group',
                ftype: 'groupingsummary',
                //ftype: 'grouping',
                groupHeaderTpl: '{name}',
    			//startCollapsed:false,
                hideGroupedHeader: true,
                //remoteRoot: 'summaryData',
                enableGroupingMenu: false
            }],
    but how to make collapse / expand stateful? the rest of the grid works (change order of columns, width, etc).

    version: 6.2.0

  2. #2
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569
    Answers
    7

    Default

    Hello Richie,

    I have created a fiddle and applied override which stores state of grouping but rest of the collapse/expand state still has an issue, so we are going to register a BUG in our tracker.

    Reference fiddle : https://fiddle.sencha.com/#view/editor&fiddle/2uiu

    Ext.define('override.data.AbstractStore', {
    override: 'Ext.data.AbstractStore',


    compatibility: '6.5.3',


    /**
    * @private
    * Returns the grouping, sorting and filtered state of this Store.
    */
    getState: function () {
    var me = this,
    sorters = [],
    filters = me.getFilters(),
    grouper = me.getGrouper(),
    filterState, hasState, result;


    // Create sorters config array.
    me.getSorters().each(function (s) {
    sorters[sorters.length] = s.getState();
    hasState = true;
    });


    // Because we do not provide a filter changing mechanism, only statify the filters if they opt in.
    // Otherwise filters would get "stuck".
    if (me.statefulFilters && me.saveStatefulFilters) {
    // If saveStatefulFilters is turned on then we know that the filter collection has changed since
    // page load. Initiate the filterState as an empty stack, which is meaningful in itself. If there
    // are any filter in the collection, persist them.
    hasState = true;
    filterState = [];
    filters.each(function (f) {
    filterState[filterState.length] = f.getState();
    });
    }


    if (grouper) {
    hasState = true;
    }


    // If there is any state to save, return it as an object
    if (hasState) {
    result = {};
    if (sorters.length) {
    result.sorters = sorters;
    }
    if (filterState) {
    result.filters = filterState;
    }
    // only save groupers, that do not use a groupFn
    if (grouper && !Ext.isFunction(grouper.getGroupFn())) {
    result.grouper = grouper.getState();
    }
    }
    return result;
    },


    /**
    * @private
    * Restores state to the passed state
    */
    applyState: function (state) {
    var me = this,
    stateSorters = state.sorters,
    stateFilters = state.filters,
    stateGrouper = state.grouper;


    if (stateSorters) {
    me.getSorters().replaceAll(stateSorters);
    }


    if (stateFilters) {
    // We found persisted filters so let's save stateful filters from this point forward.
    me.saveStatefulFilters = true;
    me.getFilters().replaceAll(stateFilters);
    }


    // do not restore groupers without a property set -> invalid grouper config!
    if (stateGrouper && !Ext.isEmpty(stateGrouper.property)) {
    me.setGrouper(stateGrouper);
    }
    },
    });




    A bug under reference EXTJS-28601 is assigned to the Engineering team for further investigation.

    Regards,
    Kumar
    Sencha Support.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •