ag-grid列标题堆放在左侧 [英] ag-grid column headers stacked to the left
问题描述
仅正确绘制了第一个列标题,而columnDef数组中的所有后续项均在其下方绘制。如果我用数据填充表格,则所有列数据也都堆叠在左侧。
Only the first column header is being drawn correctly, all subsequent items in the columnDef array are drawn below it. If I populate the table with data, all column data is stacked to the left as well.
这里是它的样子;
JS看起来像这样:
gridOptions.columnDefs = [
{ headerName: 'Country', field: 'country' },
{ headerName: 'City', field: 'city' },
{ headerName: 'Jan', field: 'jan_act' },
{ headerName: 'Feb', field: 'feb_act' },
{ headerName: 'Mar', field: 'mar_act' },
{ headerName: 'Apr', field: 'apr_act' },
{ headerName: 'May', field: 'may_act' }];
var gridDiv = document.querySelector('#myGrid');
new agGrid.Grid(gridDiv, gridOptions);
我正在使用 ag-grid.noStyle.js
v7.0.2,并认为我已经为ag-grid正确加载了所有依赖项。我不使用 React
或 Angular
。
I'm using ag-grid.noStyle.js
v7.0.2 and think I have all dependencies loaded correctly for ag-grid. Am not using React
or Angular
.
推荐答案
啊,找到了!这是<!DOCTYPE html>
标记。
Ah, found it! It's the <!DOCTYPE html>
tag.
问题立即通过将div的高度更改为来解决。基于像素的,不是%,例如
Problem was immediately resolved by changing the height of my div to pixel based, not %, e.g.
<div id="myGrid" style="height: 400px;" class="ag-fresh"></div>
通过在 JavaScript Datagrid示例也无法正常工作。
Found it by going back to absolute basics after the JavaScript Datagrid example also failed to work.
- Working with the CSS
height
property and percentage values.
这篇关于ag-grid列标题堆放在左侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!