简体   繁体   中英

ag-grid api.refreshView() does not seem to be working

The data that I load in ag grid depends on an http call and once I get the data I call the api.setRowData(data); and during debugging I see that the data that I need is there. But the grid does not show the entire data at first http response. When I make a second call only then it shows the data. Here is what I do once I get the data from http call:

gridOptions.api.setRowData(data);
gridOptions.api.refreshView();

Also in the gridOptions, I mention:

onGridReady: function() {
                    gridOptions.api.sizeColumnsToFit();
                    gridOptions.api.refreshView();
                }

Any idea what is the issue?

This single line worked for me.

onGridReady: function(event) {
    event.api.sizeColumnsToFit();
}

You may need to instantiate your grid inside an EventListener also.

I have replaced refreshView with refreshInMemoryModel() . It worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM