默认情况下,列是排列的,如果我尝试给单元格和标题设置宽度,结果没有变化。那么我该如何显式地安排列宽呢?
<DataTable style={{ height: height }}>
<DataTable.Header>
<DataTable.Title>Name</DataTable.Title>
<DataTable.Title numeric>QTY</DataTable.Title>
<DataTable.Title numeric>AMT</DataTable.Title>
<DataTable.Title numeric>TAX</DataTable.Title>
<DataTable.Title numeric>GROSS</DataTable.Title>
</DataTable.Header>
<ScrollView>
{
data && data.length > 0 ?
data.map((item, index) => {
return (
<DataTable.Row key={index}>
<DataTable.Cell>{item.NAME}</DataTable.Cell>
<DataTable.Cell numeric>{item.QTY}</DataTable.Cell>
<DataTable.Cell numeric>{item.AMT}</DataTable.Cell>
<DataTable.Cell numeric>{item.TAX}</DataTable.Cell>
<DataTable.Cell numeric>{item.GROSS}</DataTable.Cell>
</DataTable.Row>
);
})
:
false
}
</ScrollView>
</DataTable>发布于 2020-10-14 17:27:46
可以通过将flex值设置为特定单元格来设置该单元格的宽度。
例如:
<DataTable.Cell style={{flex: 3}}>https://stackoverflow.com/questions/64348744
复制相似问题