Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I want to navigate all rows in a cxGridDBTableView with multiple groups. Instad of the default behaviour, I want to skip all group headers but also to automatically expand the corresponding group if it is collapsed. The goal is for the user to be able to navigate through all rows regardless if the row is contained in a collapsed row. Also, since the navigation is done from a modal form, BeginUpdate has been called for the gridview.

                                0

                                Hi Frank,

                                I suggest that you review the "How to skip grouped records when navigating through a View" article which can be found at: www.devexpress.com/kbA849.

                                >>
                                Also, since the navigation is done from a modal form, BeginUpdate has been called for the gridview.
                                <<
                                I'm sorry, but I don't quite understand why you are calling the BeginUpdate method. Could you please clarify your goal in detail.

                                I'm awaiting your response.

                                Thanks,
                                Stan.

                                0

                                Hi, to make mit clear - when the user doubleclicks a record of the cxgridview, I call BeginUpdate and then display a form to edit the record's data. I called BeginUpdate so the grid will not change its content while the user is editing the data. The form contains a prior and a next button to navigate the records of the cxgridview without closing the form. I attached a screenshot to demonstrate the idea.

                                Screenshot.JPG
                                0

                                Hi Frank,

                                Thank you for the feedback. However, the problem is not quite clear to me. Could you please clarify in which way you are performing navigation. What code is performed within the button click events. I should also say that if you call the View's BeginUpdate method, the navigation within the grid is completely disabled. The grid layout is locked at this point. So it is not quite clear in which manner the navigation should be performed on the locked gridview. If possible, please make a small sample demonstrating your goal and showing the problem you are experiencing. I'll research it and try to provide you with an exact solution.

                                I'm awaiting your response.

                                Thanks,
                                Stan.

                                0

                                Hi Stan,
                                Navigation in the grid is NOT diabled after Calling BeginUpdate, although repainting is. The Click-Events for the two navigation buttons just contain the following code:
                                  ...
                                  try
                                    Result := aView.Controller.GoToNext(True);
                                    if Result then
                                      if aView.Controller.FocusedRow is TcxGridGroupRow then
                                        if aView.Controller.FocusedRow.Expanded then
                                          aView.Controller.GoToNext(True);
                                  except
                                    Result := False;
                                  end;
                                  ...
                                and GotoPrev respectively. AView is pointing to my grid.
                                Actually, I do not really want to navigate the grid, I want to navigate the dataset but in the order of the rows in the grid. The goal is to display the next (or the previous) record of the underlying dataset in the edit form.
                                Frank
                                Frank

                                0

                                Hi Frank,

                                Thank you for the feedback. In this case your code is correct. The only thing you missed is that you forgot to expand the group row:

                                  try
                                    Result := aView.Controller.GoToNext(True);
                                    if Result then
                                      if aView.Controller.FocusedRow is TcxGridGroupRow then
                                      begin
                                        TcxGridGroupRow(aView.Controller.FocusedRow).Expanded := True;
                                        aView.Controller.GoToNext(True);
                                      end;
                                  except
                                    Result := False;
                                  end;

                                Please try this solution and inform us of your results.

                                Thanks,
                                Stan.

                                0

                                Well yes, that's exactly the problem. The line "TcxGridGroupRow(aView.Controller.FocusedRow).Expanded := True;" has no effect, probably because I disabled the repainting with BeginUpdate.
                                Frank

                                0

                                Oops. I just tested again and it's working, kind of. The navigation works correctly, but if the number of records exceeds the number of collapsed groups, the navigation will stop before reaching the end of the grid. Seems to me because of this line in TcxCustomGridTableController.FindNextCustomItem: if not CheckIndex(AItemIndex) then Exit;
                                Frank

                                0

                                Last update: I got it working by calling EndUpdate/BeginUpdate inside the navigation like this:
                                function GotoNext(aView: TcxGridDBTableView): boolean;
                                var
                                  LockUpdates: boolean;
                                begin
                                  try
                                    try
                                      if aView.IsUpdateLocked then
                                        begin
                                        LockUpdates := True;
                                        aView.EndUpdate;
                                        end;
                                      Result := aView.Controller.GoToNext(True);
                                      if Result then
                                        if aView.Controller.FocusedRow is TcxGridGroupRow then
                                          begin
                                          TcxGridGroupRow(aView.Controller.FocusedRow).Expanded := True;
                                          aView.Controller.GoToNext(True);
                                          end;
                                    finally
                                      if LockUpdates then
                                        aView.BeginUpdate;
                                    end;
                                  except
                                    Result := False;
                                  end;
                                end;
                                The navigation in the other direction needs a little bit more work, but please close the issue.
                                Thx for the help,
                                  Frank

                                0

                                Thank you for the update, Frank. We are glad to hear that you have implemented the necessary functionality. If you have any further questions, please feel free to ask.

                                Thanks,
                                Serge

                                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