Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello,

                                    I would like to add a button (Id=btClearGroups) in order to clear all the grouped buttons in my gridview.
                                    The function which handles the button click is below:
                                     $("#btClearGroups").click(

                                                function () {

                                                    var cols = grid.columns;
                                                    for (var i = 0; i < cols.length-1; i++) {
                                                        if (grid.IsGroupRow(i) == true) {
                                                            grid.UnGroup(cols[i].fieldName);
                                                            
                                                        }
                                                       
                                                    }

                                                }
                                            );

                                    This code works well if there is only one column being grouped. However, if I have many grouped columns, it doesn't work as the GridView always reinialize the group.

                                    Is there anything else that I missed in my code?

                                    Thanks in advance for your help,

                                    Best regards,
                                    Longchrea NEAK

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Longchrea,

                                Please pardon our delayed response.

                                Every call of the client-side UnGroup method of your GridView initiates a callback to the server. Sending sequential callbacks is not a correct approach. Instead, I suggest you send a single callback by calling the client-side PerformCallback method of your GridView and pass some flag to signal that it is necessary to clear all grouped columns:

                                [JScript]
                                $(document).ready(function () { $("#btClearGroups").click( function () { gvGrouping.PerformCallback("clearGroups"); } ); });

                                To react to this callback on the server-side, handle the CustomCallback of your GridView, check if the required flag has been passed and clear grouped columns one by one:

                                [C#]
                                settings.CustomCallback = (sender, e) => { if (e.Parameters != "clearGroups") return; MVCxGridView grid = (MVCxGridView)sender; foreach (MVCxGridViewColumn column in grid.Columns) { grid.UnGroup(column); } });

                                Please let me know if this solution meet your requirements.

                                Regards,
                                Serge

                                P.S. Our records show that your "master" DevExpress account has no personal developer license assigned to the Contact sub-account you currently use with our Support Services. Please ask the owner of your "master" account to grant your personal Contact the necessary licenses. This can be accomplished through the “Manage & Assign Licenses” section of the "master" account.

                                • Longchrea NEAK 03.07.2012

                                  Hi Serge,

                                  Thanks so much for your reply. In fact, I already solved the problem by using the same approach yesterday.
                                  Concerning about the license, we've not purchased the solution yet, and now my team are working on an approsal to use DevExpress MVC.
                                  We do hope that our company will approve the purchasing of the license of the DevExpress MVC.

                                  Have a nice day,
                                  Longchrea

                                • Hi Longchrea,

                                  We are happy to hear that you have managed to find a solution for this issue. I see that your master account already contains licenses for the most recent DXperience build, v2011 vol 2.10. Please ask the owner of your "master" account to grant your personal Contact the necessary licenses. This will allow you to install our products using the credentials of your own account.

                                  Regards,
                                  Serge

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners