ant-design-blazor/site/AntDesign.Docs/Demos/Components/Table/demo/data-index.md
2021-02-06 20:15:46 +08:00

1.4 KiB
Raw Blame History

order title
2
en-US zh-CN
Data Index 数据索引

zh-CN

可以不使用 @bind-Field,而是通过设置数据类型 TData 和数据索引字符串 DataIndex 来指定要绑定的属性。列数据的类型与 TData 的定义一致。

当绑定的属性是值类型并且是Nullable时TData 应设为Nullable类型。如<Column TData="int?" DataIndex="prop1" /><Column TData="Nullable<int>" DataIndex="prop1" />

Column使用DataIndex时Table的OnChange参数 QuerModel<TItem>.SortModel[].FieldName 等于 DataIndex

DataIndex支持的访问操作类型详见路径式属性访问

en-US

Instead of using @bind-Field, you can specify the property to be bound by setting the data type TData and the data index string DataIndex, which can bind descendant properties. The type of the column data is the same as the definition of TData.

When the bound property is ValueType and is Nullable, TData should be set to Nullable type. For example: <Column TData="int?" DataIndex="prop1" /> or <Column TData="Nullable<int>" DataIndex="prop1" />.

When Column uses DataIndex, Table's OnChange event parameter QuerModel<TItem>.SortModel[].FieldName is equal to DataIndex.

See path-based-property-access for details of the access modes supported by DataIndex.