我正在"@progress/kendo-react-gri*"
为我的项目工作,我遇到了这样的问题。我的数据有五个字段,但我只想显示其中的两个,所以我只是在tsx文件中定义了三个列,如下所示:
<Grid style={{ height: "400px" }} data={products}>
<Column field="ProductID" title="ID" width="40px" />
<Column field="ProductName" title="Name" width="250px" />
</Grid>
这是我的数据:
{“ProductID”:2,“ProductName”:“Chang”,“ReorderLevel”:25,“Discontinued”:false,“Category”:{“CategoryID”:1,“CategoryName”:“Beverages”,“Description”: “软饮料,咖啡,茶,啤酒和啤酒”}
但它仍然显示五列,其中包含我的数据的所有字段。
PS:我尝试使用包装器lib,但遇到了同样的问题。
如果你想隐藏一些列,那么使用下面的代码:在kendo ui中:请使用hidden:true
参考链接:https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.hidden
在剑道React:请使用show:false
参考链接:How Can I Hide Kendo UI Grid Columns using JavaScript, React, Angular, Vue or ASP.NET MVC
谢谢,