admin管理员组文章数量:1302913
I have been working on ag grid since quite long time. Currently we got a requirement to change the grid display for mobile devices (for example width <480 px).
Does Ag grid support/convert its view for small devices? If yes, could you provide the relevant link for the same?
I have been working on ag grid since quite long time. Currently we got a requirement to change the grid display for mobile devices (for example width <480 px).
Does Ag grid support/convert its view for small devices? If yes, could you provide the relevant link for the same?
Share edited Jul 5, 2020 at 19:42 mkrieger1 23.3k7 gold badges64 silver badges81 bronze badges asked Dec 25, 2018 at 8:11 ASHOK POTHINENIASHOK POTHINENI 911 gold badge1 silver badge2 bronze badges 1- Interesting point is that the table on their landing page adjusts itself quite nice on mobile (less columns), but they don't provide any guides on this topic.. – Pavel Commented Dec 17, 2019 at 11:18
1 Answer
Reset to default 7AgGrid adjust by itself. The default themes is capable of dynamic resizing itself.
You can use params.api.sizeColumnsToFit()
in either on onGridReady
or onFirstDataRendered
. This will do dynamic resizing with scrolls.
However i would suggest to create a seperate view for mobile, display only relevant colums which makes sense in mobile view.
var column = [{ field: "Col1" }, { field: "Col2", }, { field: "Col3", }, { field: "Col4", }, { field: "Col5", }];
var mobileColumn = [{ field: "Col1" }, { field: "Col2", }, { field: "Col3", }];
window.addEventListener('resize', function () {
setTimeout(function () {
if (window.innerWidth <= 480) {
gridOptions.setColumnDefs(mobileColumn);
params.api.sizeColumnsToFit();
}
})
})
dynamically set columns for mobile view
本文标签: javascriptCan we change the view for AG grid in mobile devicesStack Overflow
版权声明:本文标题:javascript - Can we change the view for AG grid in mobile devices - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741669117a2391495.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论