diff --git a/components/select/SelectBase.cs b/components/select/SelectBase.cs index b88b0937..9518ee97 100644 --- a/components/select/SelectBase.cs +++ b/components/select/SelectBase.cs @@ -51,7 +51,7 @@ namespace AntDesign protected SelectContent _selectContent; - protected IEnumerable _selectedValues; + protected TItemValue[] _selectedValues; protected Action _setLabel; @@ -267,12 +267,12 @@ namespace AntDesign return; } - _selectedValues = value; + _selectedValues = value.ToArray(); _ = OnValuesChangeAsync(value); } else { - _selectedValues = value; + _selectedValues = value.ToArray(); _ = OnValuesChangeAsync(value); } diff --git a/components/tree-select/TreeSelect.razor.cs b/components/tree-select/TreeSelect.razor.cs index 0410cbca..90e67b75 100644 --- a/components/tree-select/TreeSelect.razor.cs +++ b/components/tree-select/TreeSelect.razor.cs @@ -170,11 +170,11 @@ namespace AntDesign if (!hasChanged) return; - _selectedValues = value; + _selectedValues = value.ToArray(); } else if (value != null && _selectedValues == null) { - _selectedValues = value; + _selectedValues = value.ToArray(); } else if (value == null && _selectedValues != null) { diff --git a/site/AntDesign.Docs/Demos/Components/Select/demo/TableSelect.razor b/site/AntDesign.Docs/Demos/Components/Select/demo/TableSelect.razor new file mode 100644 index 00000000..ba6b318b --- /dev/null +++ b/site/AntDesign.Docs/Demos/Components/Select/demo/TableSelect.razor @@ -0,0 +1,65 @@ +@using AntDesign.Docs.Services + + +@inject IconListService _iconListService +@code +{ + ITable table; + IEnumerable selectedRows=[]; + + class Column + { + public string Name { get; set; } + + public int Age { get; set; } + + public string Address { get; set; } + } + + Column[] data = + { + new Column() + { + Name = "John Brown", + Age = 32, + Address = "New York No. 1 Lake Park", + }, + new Column() + { + Name = "Jim Green", + Age = 42, + Address = "London No. 1 Lake Park", + }, + new Column() + { + Name = "Joe Black", + Age = 32, + Address = "Sidney No. 1 Lake Park", + }, + new Column() + { + Name = "Disabled User", + Age = 99, + Address = "Sidney No. 1 Lake Park", + } + }; +} diff --git a/site/AntDesign.Docs/Demos/Components/Select/demo/table-select.md b/site/AntDesign.Docs/Demos/Components/Select/demo/table-select.md new file mode 100644 index 00000000..c57f3394 --- /dev/null +++ b/site/AntDesign.Docs/Demos/Components/Select/demo/table-select.md @@ -0,0 +1,14 @@ +--- +order: 23 +title: + zh-CN: 列表选择器 + en-US: Table Select +--- + +## zh-CN + +利用自定义下拉模板实现列表选择器。 + +## en-US + +Implement a list selector with a custom dropdown render. \ No newline at end of file