1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
    dimitri.fedorov is on a distinguished road

      0  

    Default Ext.dataview.List: Different functions for grouping string and grouping title

    Ext.dataview.List: Different functions for grouping string and grouping title


    Hi there.
    I got a set of records with datestamp, and I want them grouped / sorted by date. Obviously, I don't want grouping string, like "2012-01-24 12:00", to be a header, I want something more fancy.

    Is there any way to provide different string for grouping and for group title?
    Thanks.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    It all runs off the grouper function in the store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
    dimitri.fedorov is on a distinguished road

      0  

    Default


    If I'm getting you right, we have the same grouper function for both grouping string and group header, so there's no way to differentiate them?

    Okay, thanks. Gotta try some tricks then.

  4. #4
    Sencha User
    Join Date
    Apr 2008
    Posts
    51
    Vote Rating
    0
    Michou is on a distinguished road

      0  

    Default


    In [PR3] it was possible (getGroupString = group header), but in [PR4] it seems that the grouping string is now automatically added to the sorters.

    My (sad) way :
    Code:
    grouper : {
        groupFn: function(record) { 
            var MySort = ...;
            return '<span style="display:none;">'+cMySort+'</span>' + record.get('cHeader');
        }
    }

  5. #5
    Sencha User
    Join Date
    Oct 2009
    Posts
    23
    Vote Rating
    2
    ivanleblanc is on a distinguished road

      0  

    Default


    This was a problem for me as well when I migrated from ST1 to ST2.
    I added this override, it seemed to be the least painful way to render something different into the header dom list item other than the grouped string that the store's grouper.groupFn returns.

    The override checks to see if you have a config option call grpRenderer on the Ext.dataview.List which needs to be a function. Before the HTML code is passed to doAddHeader the grpRenderer gets called with these parameters: list, text, record, records

    list = the Ext.dataview.List
    text = the string returned by the groupFn (which is what is actually being grouped on)
    record = the the first record in the current group
    records = all the records in the current group

    Code:
    grpRenderer: function(list, text, record, records) {
         
    }
    Code:
    Ext.override(Ext.dataview.List, {
       findGroupHeaderIndices: function() {
            if (!this.getGrouped()) {
                return [];
            }
            var me = this,
                store = me.getStore();
            if (!store) {
                return [];
            }
    
    
            var container = me.container,
                groups = store.getGroups(),
                groupLn = groups.length,
                items = container.getViewItems(),
                newHeaderItems = [],
                footerClsShortCache = container.footerClsShortCache,
                i, firstGroupedRecord, index, item, lastGroup;
    
    
            container.doRemoveHeaders();
            container.doRemoveFooterCls();
    
    
            if (items.length) {
                for (i = 0; i < groupLn; i++) {
                    firstGroupedRecord = groups[i].children[0];
                    index = store.indexOf(firstGroupedRecord);
                    item = items[index];
                    
                    // *** My Code Start ***
                    var grpText = store.getGroupString(firstGroupedRecord);
                    if(Ext.isDefined(me.getGrpRenderer)) {
                        var grpRenderer = me.getGrpRenderer();
                        if(grpRenderer) {
                            grpText = grpRenderer(me, grpText, firstGroupedRecord, groups[i].children);
                        }
                    }
                    container.doAddHeader(item, grpText);
                    // *** My Code End ***
                    
                    // container.doAddHeader(item, store.getGroupString(firstGroupedRecord));
                    // Skip footer before the first Header
                    if (i) {
                        Ext.fly(item.previousSibling).addCls(footerClsShortCache);
                    }
                    newHeaderItems.push(index);
                }
                // Add footer before the last item
                lastGroup = groups[--i].children;
                Ext.fly(items[store.indexOf(lastGroup[lastGroup.length - 1])]).addCls(footerClsShortCache);
            }
    
    
            return newHeaderItems;
        }
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar