最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - AG-Grid v33+: Install via CDN, but don't use CDN for themes - Stack Overflow

programmeradmin9浏览0评论

How do I use predefined themes in the theme builder when using CDNs?

Background

  • AG-Grid docs specify that it is acceptable to use a CDN for ag-grid-community.
  • AG-Grid 33+ errors when using < div class="ag-theme-balham" and recommends using the Theme API.
  • AG-Grid does not find themeBalham for gridOptions = {theme: <theme>} from the any CDNs that I tried:
<!-- AG-Grid + Styles -->
<script src=".min.js"></script>
<link  href=".min.css" rel="stylesheet">
<link  href=".min.css" rel="stylesheet">

How do I use predefined themes in the theme builder when using CDNs?

Background

  • AG-Grid docs specify that it is acceptable to use a CDN for ag-grid-community.
  • AG-Grid 33+ errors when using < div class="ag-theme-balham" and recommends using the Theme API.
  • AG-Grid does not find themeBalham for gridOptions = {theme: <theme>} from the any CDNs that I tried:
<!-- AG-Grid + Styles -->
<script src="https://cdn.jsdelivr/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
<link  href="https://cdn.jsdelivr/npm/ag-grid-community/styles/ag-grid.min.css" rel="stylesheet">
<link  href="https://cdn.jsdelivr/npm/ag-grid-community/styles/ag-theme-balham.min.css" rel="stylesheet">
Share Improve this question edited Mar 22 at 19:50 desertnaut 60.5k32 gold badges155 silver badges181 bronze badges asked Mar 21 at 19:14 kandokando 6051 gold badge7 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

With CDN, instead of

import { someVariableName } from 'ag-grid-community',

just use

agGrid.someVariableName

wherever desired.

For example:

const gridOptions = {
  columnDefs: columnDefs,
  rowData: rowData,
  theme: agGrid.themeBalham.withPart(agGrid.colorSchemeDark),
};
发布评论

评论列表(0)

  1. 暂无评论