Our blazing fast Grid component built with pure JavaScript


Post by myplan@cegeka.it »

Dear Bryntum Support Team,
I am reaching out regarding an issue we’ve encountered with the Grid rows-grouping functionality in your product.

Specifically, when I attempt to group rows by any field, the grouped rows displayed do not match the actual rows within the grouping. This leads to incorrect or inconsistent grouping results, making the feature unusable in its current state.

We’ve reviewed the documentation and tried several troubleshooting steps, but the problem persists. Could you please provide guidance or investigate this issue further?

Thank you for your assistance, and I look forward to your reply.

Best regards,
GPA

const store_Items = new bryntum.grid.AjaxStore({
    // This will create an AjaxStore
    readUrl: '/MRP/View/Items/Read',
    // This will activate the lazy load functionality
    lazyLoad: {
        chunkSize: 50
    },
    // This will load the Store initially upon creation
    autoLoad: true,
    // remoteSort: true,
    // remoteFilter: true,
    useRestfulMethods: true,
    multiSort: true,
    httpMethods: {
        "create": "POST",
        "read": "POST",
        "update": "PUT",
        "delete": "DELETE"
    },
    headers: {
        'content-type': 'application/json; charset=UTF-8'
    },
    paramsInBody: true,
    sendAsFormData: false,
    sortParamName: 'sort', // Nome del parametro per il sort
    filterParamName: 'filters', // Nome del parametro inviato
    emptyText: "No data is available",
    listeners: {
        load({
            response
        }) {
            const unfilteredTotal = response.parsedJson.effectiveTotalRows;
            // Puoi memorizzare il valore da qualche parte, ad esempio in una variabile globale
            window.unfilteredTotal = unfilteredTotal;
        }
    },
    params: SetAjaxParameters({"viewName":"MRP_DispoRiassuntiva","AggregationDetailId":1,"DateOptionId":null,"DateOption":{"Id":1,"Name":"EndDate"},"StartDate":null,"EndDate":null,"MinEventStartDate":"2000-01-01T00:00:00","MaxEventStartDate":"3000-01-01T00:00:00","MinEventEndDate":"2000-01-01T00:00:00","MaxEventEndDate":"3000-01-01T00:00:00","WarehouseMRPFilter":"(null)","ForceTableRebuild":false,"SqliteQueryName":null,"IsShortcutNavigation":false,"AggregatedItemId":null,"AggregatedItemOppTableId":null,"dashboardCardId":null,"dashboardFilterList":[],"dashboardType":null,"count":0,"startIndex":0,"sort":"[]","filters":"[]","columns":[{"autoHeight":null,"autoWidth":null,"field":"RecordId","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"RecordId","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"string","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":0},{"autoHeight":null,"autoWidth":null,"field":"ItemId","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"ItemId","width":null,"readOnly":null,"hidden":null,"cellCls":"b-grid-cell-time-phased-link","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"string","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":1},{"autoHeight":null,"autoWidth":null,"field":"Description","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"Description","width":null,"readOnly":null,"hidden":null,"cellCls":"b-grid-cell-description-popup","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"string","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":2},{"autoHeight":null,"autoWidth":null,"field":"DynamicSafetyStockDays","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"DynamicSafetyStockDays","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"double","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":3},{"autoHeight":null,"autoWidth":null,"field":"UnitOfMeasure","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"UnitOfMeasure","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"string","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":4},{"autoHeight":null,"autoWidth":null,"field":"MainSupplier","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"MainSupplier","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"string","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":5},{"autoHeight":null,"autoWidth":null,"field":"StockOutDays","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"StockOutDays","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"int32","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":6},{"autoHeight":null,"autoWidth":null,"field":"MinStockDays","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"MinStockDays","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"int32","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":7},{"autoHeight":null,"autoWidth":null,"field":"MaxStockDays","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"MaxStockDays","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"int32","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":8},{"autoHeight":null,"autoWidth":null,"field":"OnHand","fitMode":null,"flex":null,"listeners":null,"maxWidth":null,"text":"OnHand","width":null,"readOnly":null,"hidden":null,"cellCls":"","cls":null,"renderer":null,"sortable":null,"locked":null,"draggable":null,"resizable":"true","type":"double","headerMenuItems":null,"cellMenuItems":null,"children":null,"mrpName":null,"index":9}}],"search":null,"ColumnsDefinition":null,"ColReorder":null,"Warning":null,"Context":null,"SubContext":null,"RecordId":null,"SelectAllFlag":false,"SelectedRecords":[],"SelectedColumns":[],"FilterHistory":[],"ExpandedRecords":[],"Export":false,"ExportWithLayout":false,"ExportAllViews":false,"GroupActionId":null,"ViewId":"Items_20250131054200","IsPageRefreshRequest":false},{"Context":"Items","SubContext":"Company","SelectAllFlag":false,"SelectedRecords":"","RecordId":"RecordId","MyPlanContext":{"Id":"Items","MyPlanModule":{"Id":"MRP"},"MyPlanCategory":{"Id":"View"},"Action":"Items","Url":"/MRP/View/Items","UseUrl":true,"TargetBlank":true,"AllowChooseParameters":true,"ForceChooseParameters":false,"OmitModuleInContextUrl":false,"IsFavourite":true,"AuthorizedModules":[{"Id":"MRP"}],"RequiredAuthorizedRoles":null,"DashboardCategoryId":"0e4afce5-9977-4cfc-aaf1-964ffc3d9176"}}),
    onAfterRequest({
        exception,
        action,
        exceptionType,
        response,
        json
    }) {

    if (json != undefined && json.data != undefined && json.data.length == 0) {
        grid_Items.renderContents();
    }
}
});

var firstLoadItems = true;
// Adding a listener using the "on" method
store_Items.on('beforeRequest', ({
        source,
        url,
        params,
        body,
        action
    }) => {
    var tableId = 'Items';
    var table = bryntum.grid.Grid.getById(tableId);

if (firstLoadItems) {
    firstLoadItems = false;
    params["FilterHistory"] = [];
    //table.store.params = params;
    //Gestione Layout
    $.ajax({
        url: '/TableViewLayout/LoadTableState/25047',
        dataType: 'json',
        async: false,
        success: function (json) {
            var currentColumns = [
                {
                    Title: 'RecordId',
                    Name: "RecordId",
                    Visible: true,
                    Width: "",
                    DataType: "string",
                    Index: 0,
                    OrderIndex: 0,
                    resizable: true,
                    locked: true,
                    draggable: false,
                    region: 'leftLocked'

                }, {
                    Title: 'ItemId',
                    Name: "ItemId",
                    Visible: true,
                    Width: "",
                    DataType: "string",
                    Index: 1,
                    OrderIndex: 1,
                    resizable: true,
                    locked: true,
                    draggable: false,
                    region: 'leftLocked'

                }, {
                    Title: 'Description',
                    Name: "Description",
                    Visible: true,
                    Width: "",
                    DataType: "string",
                    Index: 2,
                    OrderIndex: 2,
                    resizable: true,
                    locked: true,
                    draggable: false,
                    region: 'leftLocked'

                }, {
                    Title: 'DynSS',
                    Name: "DynamicSafetyStockDays",
                    Visible: true,
                    Width: "",
                    DataType: "double",
                    Index: 3,
                    OrderIndex: 3,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'UnitOfMeasure',
                    Name: "UnitOfMeasure",
                    Visible: true,
                    Width: "",
                    DataType: "string",
                    Index: 4,
                    OrderIndex: 4,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'MainSupplier',
                    Name: "MainSupplier",
                    Visible: true,
                    Width: "",
                    DataType: "string",
                    Index: 5,
                    OrderIndex: 5,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'StockOutDaysxx',
                    Name: "StockOutDays",
                    Visible: true,
                    Width: "",
                    DataType: "int32",
                    Index: 6,
                    OrderIndex: 6,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'MinStockDays',
                    Name: "MinStockDays",
                    Visible: true,
                    Width: "",
                    DataType: "int32",
                    Index: 7,
                    OrderIndex: 7,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'MaxStockDays',
                    Name: "MaxStockDays",
                    Visible: true,
                    Width: "",
                    DataType: "int32",
                    Index: 8,
                    OrderIndex: 8,
                    resizable: true,
                    locked: false,
                    draggable: true

                }, {
                    Title: 'OnHand',
                    Name: "OnHand",
                    Visible: true,
                    Width: "",
                    DataType: "double",
                    Index: 9,
                    OrderIndex: 9,
                    resizable: true,
                    locked: false,
                    draggable: true
                }
            ];
			
			
            $.each(json.ColumnsDefinition, function (i, col) {
                var sameCol = currentColumns.find(x => x.Name === col.Name);
                if (sameCol) {
                    if (sameCol.Index !== col.Index)
                        sameCol.Index = col.Index;
                    if (sameCol.OrderIndex !== col.OrderIndex)
                        sameCol.OrderIndex = col.OrderIndex;
                    if (sameCol.Title !== col.Title)
                        sameCol.Title = col.Title;
                    if (sameCol.Visible !== col.Visible)
                        sameCol.Visible = col.Visible;
                }
                //currentColumns.push({ Title: col.Title, Name: col.Name, Visible: col.Visible, Width: col.Width, DataType: col.DataType, Index: i, OrderIndex: i });
            });

            //Validation of the Layout
            var validationResult = ValidateLayoutState(tableId, json, null, currentColumns);
            //If Layout needs changes, save it
            if (validationResult.NeedUpdate) {
                validationResult.State.LayoutProfileId = "25047";
                UpdateSavedLayoutState(tableId, validationResult.State, true, null);
            }
        }
    });
}
});

let settingGrid_Items = {
    appendTo: "container_Items",
    id: "Items",
    features: {
        search: true,
        cellEdit: false,
        summary: false,
        group: true,
        // group : {
        // 			renderer({ column, groupColumn, groupRowFor, count, isFirstColumn, record })
        // 			{
        // 				debugger;
        // 				return `${count} <span style="font-size: .7em; margin: 0 .5em">x</span> ${groupRowFor} star ratings`;
        // 			}
        // 		}
    },
    columns:
    [
        {
            field: 'RecordId',
            text: 'RecordId',
            type: '',
            hidden: false,
            locked:
            true,
            draggable: false,
            region: "leftLocked",
            groupable: false,
            index: '0',
            cellCls: '',
            resizable: true
        },
        {
            field: 'ItemId',
            text: 'ItemId',
            type: '',
            hidden: false,
            locked:
            true,
            draggable: false,
            region: "leftLocked",
            groupable: false,
            index: '1',
            cellCls: 'b-grid-cell-time-phased-link',
            resizable: true
        },
        {
            field: 'Description',
            text: 'Description',
            type: '',
            hidden: false,
            locked:
            true,
            draggable: false,
            region: "leftLocked",
            groupable: false,
            index: '2',
            cellCls: 'b-grid-cell-description-popup',
            resizable: true
        },
        {
            field: 'DynamicSafetyStockDays',
            text: 'DynSS',
            type: 'number',
            hidden: false,
            locked:
            false,
            index: '3',
            cellCls: '',
            resizable: true
        },
        {
            field: 'UnitOfMeasure',
            text: 'UnitOfMeasure',
            type: '',
            hidden: false,
            locked:
            false,
            index: '4',
            cellCls: '',
            resizable: true
        },
        {
            field: 'MainSupplier',
            text: 'MainSupplier',
            type: '',
            hidden: false,
            locked:
            false,
            index: '5',
            cellCls: '',
            resizable: true
        },
        {
            field: 'StockOutDays',
            text: 'StockOutDaysxx',
            type: 'number',
            hidden: false,
            locked:
            false,
            index: '6',
            cellCls: '',
            resizable: true
        },
        {
            field: 'MinStockDays',
            text: 'MinStockDays',
            type: 'number',
            hidden: false,
            locked:
            false,
            index: '7',
            cellCls: '',
            resizable: true
        },
        {
            field: 'MaxStockDays',
            text: 'MaxStockDays',
            type: 'number',
            hidden: false,
            locked:
            false,
            index: '8',
            cellCls: '',
            resizable: true
        },
        {
            field: 'OnHand',
            text: 'OnHand',
            type: 'number',
            hidden: false,
            locked:
            false,
            index: '9',
            cellCls: '',
            resizable: true
        }

],

selectionMode: {
    rowCheckboxSelection: true,
    showCheckAll: true,
    checkbox: true,
    multiSelect: true
},
store: store_Items,
listeners: {
    ready: () => {

        setRowSelection("Items");
    }
},
};

settingGrid_Items.features["cellMenu"] = getStandardRowsMenu('Items');

settingGrid_Items.features["headerMenu"] = getStandardHeaderMenu('Items');

const grid_Items = new bryntum.grid.Grid(settingGrid_Items);
grid_Items.store.on({
    lazyLoadEnded: () => {
        if ($('#b-checkbox-1-input').prop('checked')) {
            grid_Items.selectAll();
        }
    }
});

Attachments
Image Pre - Grouping
Image Pre - Grouping
ImagePreGrouping.png (27.18 KiB) Viewed 229 times
Image Post - Grouping
Image Post - Grouping
ImagePostGrouping.png (13.7 KiB) Viewed 229 times

Post by alex.l »

Hi there!

The code you posted is not runnable, so I can't reproduce and check the problem. Please fix the code and attach runnable demo with steps to reproduce.

SetAjaxParameters is not defined

Please check the guide how to ask for help by the link attached in the end of this message. Best of all if you apply required changes to our demo. The source code of all demos you can find in /examples folder of sources you downloaded.

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post by myplan@cegeka.it »

Hi Alex,

I’ve deployed the test page: https://myplanweb.azurewebsites.net/code.html.

If you try using the grouping function within the HeaderMenu context, you’ll notice the issue.

Let me know if you need more details.

Best regards,
Giuseppe Panebianco


Post by tasnim »

Hi,

I've checked the link you provided it's showing the data loading is failed.

msedge_KCdnC9WXV6.png
msedge_KCdnC9WXV6.png (62.43 KiB) Viewed 196 times

Could you please attach a runnable test case here so we can run/test it locally? it will be easier for us to check locally :)


Post by myplan@cegeka.it »

Hi Alex,

I have deployed the new version. The link is now: https://myplanweb.azurewebsites.net/code.htm.

I didn’t test it locally because the backend endpoint requires authorization.

Thanks,
Best regards,
Giuseppe Panebianco


Post by ghulam.ghous »

Hey there,

Thanks for sharing this. The link is working. I can see the problem on your end. But it seems to me more of an application level problem rather than the issue on end. I have extracted the data and tried to group and it worked just fine. Which version of the Grid are you using? If it is not latest, try upgrading to the latest. Second please try extracting the minimum code required to reproduce this issue and share with us. We can not debug a deployed link. Also please try with your config here in this example. https://bryntum.com/products/grid/examples/basic/. You can extract data and other configs and use in this exmaple. Please share the results or as Alex have said above, a runnable test case.


Post by myplan@cegeka.it »

Hi,

I have attached the file code.txt, which contains the HTML page of the example.

To test it, you need to run Chrome with CORS security disabled.

You can use the following command:

chrome.exe --disable-web-security --user-data-dir="C:/chrome_dev"

Thanks,
Best regards,
Giuseppe


Post by marcio »

Hey Giuseppe,

There is no code.txt file on this topic, perhaps you forgot to attach it?

Also, if you could provide an adapted demo code as Ghulam and Alex mentioned, it would be faster and easier for us to assist you on this topic.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by myplan@cegeka.it »

Hi,
I had trouble attaching the file earlier.
Now, I have attached a ZIP file containing the HTML page and a JSON file for the data.

We are able to reproduce the issue.

Thanks

Best regards,
Giuseppe

Attachments
code.zip
html page
(5.88 KiB) Downloaded 2 times
jsonData.json
file with data
(12.16 KiB) Downloaded 2 times

Post by alex.l »

Hi,

I was not able to use remote data even after follow instructions with CORS enable. Btw, do we need remote data for that, if the problem in local grouping?

I tried data JSON you attached. How to reproduce the problem? Please provide steps to reproduce, actual and expected result.
Here is a video with my attempts to reproduce the problem

Screen Recording 2025-02-06 at 20.22.54.mov
(7.25 MiB) Downloaded 1 time

All the best,
Alex Lazarev

How to ask for help? Please read our Support Policy

We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services


Post Reply