gijgo icon indicating copy to clipboard operation
gijgo copied to clipboard

Bug with grid in grid and keepExpandedRowsDefault:true

Open VladG1972 opened this issue 4 years ago • 1 comments

Bug? I have a main grid with keepExpandedRowsDefault : true and a grid nested in it. When the rows of the upper grid are opened after the update, the nested grids are not saved - the part is closed, and the selected one is shown open, but without the mode. While using keepExpandedRowsDefault : false

Example code from You page:

<!DOCTYPE html>
<html>
<head>
    <title>Nested jQuery Grids</title>
    <meta charset="utf-8" />
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://unpkg.com/[email protected]/js/gijgo.min.js" type="text/javascript"></script>
    <link href="https://unpkg.com/[email protected]/css/gijgo.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="container-full">
      <button id="btn">reload</button>
        <div class="row">
            <div class="col-xs-12">
                <table id="grid"></table>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            var grid = $('#grid').grid({
                primaryKey: 'ID',
                dataSource: '/Players/Get',
                columns: [
                    { field: 'ID', width: 56 },
                    { field: 'Name' },
                    { field: 'PlaceOfBirth', title: 'Place Of Birth' }
                ],
                detailTemplate: '<div><table/></div>'
            });
            grid.on('detailExpand', function (e, $detailWrapper, id) {
                $detailWrapper.find('table').grid({
                    params: { playerId: id },
                    dataSource: '/Players/GetTeams',
                    autoGenerateColumns: true,
                    pager: { limit: 5 }
                });
            });
            grid.on('detailCollapse', function (e, $detailWrapper, id) {
                $detailWrapper.find('table').grid('destroy', true, true);
            });
          	$("#btn").on('click', function () { grid.reload(); });
        });
    </script>
</body>
</html>

When open Nested grid I see

Request URL: https://gijgo.com/Players/GetTeams?playerId=1&page=1&limit=5 Request URL: https://gijgo.com/Players/GetTeams?playerId=2&page=1&limit=5

And when press button reload I see: Request URL: https://gijgo.com/Players/Get Request URL: https://gijgo.com/Players/GetTeams?page=1&limit=5 Request URL: https://gijgo.com/Players/GetTeams?page=1&limit=5 without param playerId

VladG1972 avatar Apr 08 '20 15:04 VladG1972

Experiencing the same issue; seems to be caused by expandDetail and collapseDetail for grids comparing to undefined instead of 'undefined' - see https://github.com/atatanasov/gijgo/blob/01fa532c414c220e1e819c640d32c0cceeb67e2f/src/grid/js/grid.expandCollapseRows.js#L164 and https://github.com/atatanasov/gijgo/blob/01fa532c414c220e1e819c640d32c0cceeb67e2f/src/grid/js/grid.expandCollapseRows.js#L182

mihailboev avatar Mar 07 '23 15:03 mihailboev