Current filter:
                                You should refresh the page.
                                  • I have a Master and Detail grids.  When loading the master grid, it will only show the + to expand the grid to show the details based on a value in the grid.

                                    Here is the code that I am using.

                                        settings.Init = (s, e) =>
                                        {
                                            MVCxGridView grid = (MVCxGridView)s;
                                            grid.DetailRowGetButtonVisibility += (sender, args) =>
                                            {
                                                var detailRowHandlerGrid = (MVCxGridView)sender;
                                                var value = Convert.ToString(detailRowHandlerGrid.GetRowValuesByKeyValue(args.KeyValue, "UseActivities"));
                                                if (value == "N")
                                                    args.ButtonState = GridViewDetailRowButtonState.Hidden;
                                            };
                                        };

                                    What I am looking to do is when I click on a checkbox on that row called ChangeActivity, I would like to then change that row so it can be expanded.

                                    I have tried s.ExpandDetailRow(e.visibleIndex); and it did not work.

                                    Here is the JavaScript code.

                                    function OnCheckChanged(s, e) {

                                        e.ProcessOnServer = true;

                                        var ID = s.name;

                                        var PrimaryKey = ID.substring(14, ID.length);

                                        var ColumnToChange = ID.substring(0, 14);

                                        var ColumnChecked = s.GetChecked();

                                        if (ColumnChecked) {
                                            PayCodeActivity.PerformCallback({ ID: PrimaryKey, NewAmount: 1, ColumnToChange: ColumnToChange });
                                            //s.ExpandDetailRow(e.visibleIndex);
                                        }
                                        else {
                                            PayCodeActivity.PerformCallback({ ID: PrimaryKey, NewAmount: 0, ColumnToChange: ColumnToChange });
                                            //s.CollapseDetailRow(e.visibleIndex);
                                        }

                                    }

                                    Attached are the GridViews, Controller and Javascript Files.

                                    Thanks in Advance.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                Having reviewed your code, I noticed that you are trying to access the ProcessOnServer and visibleIndex in the ASPxClientCheckBox.CheckedChanged event handler. Please note that this event does not provide these properties in the EventArgs collection - see the event's documentation for details. Most likely, this code throws JavaScript exceptions in the Console tab of the browser. You can check this by applying recommendations from the How to enable script debugging KB article. I recommend you not to use them to avoid further issues.

                                I see that you call the PerfromCallback method passing the row id to a controller. In this case, I recommend you do the following:

                                1. Save the ID to ViewBag in the CustomCallBackActionActivity method.
                                2. Handle GridView's BeforeGetCallbackResult event. In this event handler, call the GridView.DetailRows.ExpandRowByKey method:
                                [C#]
                                settings.BeforeGetCallbackResult = (sender, e) => { MVCxGridView gridView = sender as MVCxGridView; gridView.DetailRows.ExpandRowByKey(ViewBag.RowId); };
                                • RHDWeb 10.10.2019

                                  The BeforeGetCallbackResult is not being called.

                                • RHDWeb 10.10.2019

                                  I found out that it is being called when I expand a row.

                                  Not after updating a field on the row.

                                • Stanley (DevExpress Support) 10.10.2019

                                  Hello,

                                  Your task is not completely clear to me. As far as I see in your code, you are trying to expand/collapse a row in the CheckedChanged event handler. Since you perform a custom callback, you can expand/collapse a row on the server side in the BeforeGetCallbackResult event handler. If this event is not raised, I recommend you check your Console for JavaScript errors and make sure that a callback request is sent to the server in the Network tab.

                                  If your task is different, please describe it in detail, send us a couple of screenshots illustrating what you want to implement and send us a simple runnable project with test data illustrating your current attempts. We will research the project and provide you with further recommendations.

                                  Thanks,
                                  Stanley