[CLOSED] Replacement for store.groupby

  1. #1

    [CLOSED] Replacement for store.groupby

    I'm updating some legacy code originally written with a much older version of Ext.Net.

    In one of the gridpanels in use, there is a set of buttons for altering the way that the displayed data is grouped (allowing for the user to pick one of 5 columns to group by, and hiding the ones not used).

    The javascript ode to accomplish the change in grouping is a switch-case structured as follows:

                switch (index) {
                    case 0: // Column1
                        App.StoreName.groupBy("Column1", true);
                        App.GridPanelName.getColumnModel().setHidden(0, true);
                        App.GridPanelName.getColumnModel().setHidden(1, false);
                        App.GridPanelName.getColumnModel().setHidden(2, true);
                        App.GridPanelName.getColumnModel().setHidden(3, true);
                        break;
                    case 1: // Column2
                        App.StoreName.groupBy("Column2", true);
                        App.GridPanelName.getColumnModel().setHidden(0, false);
                        App.GridPanelName.getColumnModel().setHidden(1, true);
                        App.GridPanelName.getColumnModel().setHidden(2, true);
                        App.GridPanelName.getColumnModel().setHidden(3, true);
                        break;
                    ...
                }
    It appears that there is no longer a "groupBy" method that applies that way. The examples site shows some examples of grouping, but not of changing which column the gridpanel or store are grouped by.

    What's the correct way to dynamically change the column that a store is grouped by with the current version of Ext.Net?
    Last edited by fabricio.murta; Oct 19, 2018 at 5:06 PM. Reason: no feedback from the user in 7+ days
  2. #2
    Ok, so it appears that you just do this in the codebehind now, which is fine. I added a "features" section to the gridpanel with a groupingsummary, and the summary line at the end of each group is displayed.

    What I'm not seeing now is the text matching the grouped value in the collapsible header for each group. It appears from the example that the column value set in the groupheadertplstring for the groupingsummary should be displayed at the beginning of each group. I am dynamically setting that to {[columnname]} when switching groupby settings. I see that in the html markup, the value I expect to see is in the properties of the colapsible div in the data-groupname attribute, but it doesn't show up as header text inside the div.

    Thoughts?
  3. #3
    Hello!

    I just noticed I overlooked your thread here, and it's been some time already! Sorry for that. I'll take a good look and will share with you any thought about your inquiries, if we have some clue.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Now, going on the actual answer.

    I've looked up in latest Ext.NET, the method to apply the grouping is now group(), and it takes the column's dataIndex field name and optionally an ordering of the groups. Further information here: Ext JS documentation on Ext.data.Store.group().

    So then, going to a more practical approach, if you open this example (link goes outside the examples explorer shell for easier interaction via console):
    - Grouping grid panel

    If in that example you click the lower-right "Clear Grouping" button, you'll notice the grouping will be all "dismantled". Alright. Then, if via console you do:

    App.GridPanel1.getStore().group('Indoor');
    You'll notice the grouping will have been switched to the true/false 'indoor' column. But you'll also notice the column will still be there, so there's still the need to hide it. If grouped from the drop-down menu in the column header, the grouped column would have been also hidden by itself.

    Then, to have the same functionality as clicking from the menu, all you can do (still in the example above), is:

    App.GridPanel1.getStore().group('Indoor');
    Ext.each(App.GridPanel1.getColumns(), function(data, index) {
     if (data.dataIndex == App.GridPanel1.getStore().getGroupField()) {
      data.hide();
      return false; // stop traversing the list of columns if already found
     }
    })
    I hope the chosen example was a good testbed to show the concepts; and that it comes in useful for you; it really helps to base the research in some actually usable code, as we can never tell how exactly a code snippet could run, as context may change so much.

    Hope this helps!

    EDIT: What you said here seems to no longer be actual with current Ext.NET:
    Quote Originally Posted by astovall
    I see that in the html markup, the value I expect to see is in the properties of the colapsible div in the data-groupname attribute, but it doesn't show up as header text inside the div
    Without further code it shows the column's title text just fine. If in doubt, just try the commands above with the example pointed, it shows 'Indoor?: [false/true]' accordingly.
    Last edited by fabricio.murta; Jul 28, 2018 at 5:46 AM.
  5. #5
    Hello @astovall!

    We've responded this inquiry for some days already, and still no feedback from you. Did the answer above help you at all? Do you still need help with this?

    We're looking forward to your follow-up. We may mark this thread as closed if you do not reply in 7+ days from now, but that won't mean we locked the thread; you'll still be able to post your messages here whenever you feel fit.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] hideTabStripItem replacement
    By Z in forum 3.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 26, 2015, 1:25 PM
  2. [CLOSED] Store client side .getSortState() replacement
    By vadym.f in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 01, 2013, 2:37 PM
  3. [CLOSED] What is the replacement of Save event of store in ext js 4.0
    By advBackOffice in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 06, 2012, 1:16 PM
  4. Replies: 1
    Last Post: Aug 21, 2012, 7:37 AM
  5. Replies: 6
    Last Post: May 26, 2009, 3:03 PM

Tags for this Thread

Posting Permissions