[英]Mudblazor Table Draggable Rows
I'm a newbie looking for some guidance on how to implement draggable rows on a Mudblazor table.我是一名新手,正在寻找有关如何在 Mudblazor 表上实现可拖动行的指导。 I didn't see any in Mudblazor's API docs regarding this subject.我在 Mudblazor 的 API 文档中没有看到任何关于此主题的内容。 I'd prefer to not use JS if possible.如果可能的话,我宁愿不使用 JS。 Does anyone have any insight on how I would do this?有没有人对我将如何做到这一点有任何见解? Or any resources I could read?或者我可以阅读的任何资源?
There isn't a perfect solution out of the box.没有开箱即用的完美解决方案。 You can try playing with Dropzone and SimpleTable , but this will separate header from rows, so you will have to find the correct sizes for colums.您可以尝试使用Dropzone和SimpleTable ,但这会将 header 与行分开,因此您必须为列找到正确的大小。
<MudDropContainer T="string" Items="@rows" ItemsSelector="@((item,dropzone) => true)" Class="d-flex flex-wrap flex-grow-1">
<ChildContent>
<MudSimpleTable Style="overflow-x: auto;">
<thead>
<tr><th>ID</th></tr>
</thead>
<tbody>
<MudDropZone T="string" Identifier="dropzone" Class="flex-grow-1" AllowReorder="true" />
</tbody>
</MudSimpleTable>
</ChildContent>
<ItemRenderer>
<tr>
@foreach (var x in @context.Split())
{
<td>@x</td>
}
</tr>
</ItemRenderer>
</MudDropContainer>
@code {
string[] rows = {
"1","2","3","4","5","6","7","8","9","10"
};
}
Try it here: https://try.mudblazor.com/snippet/wkcxYFRlqLyfsQlu在这里试试: https://try.mudblazor.com/snippet/wkcxYFRlqLyfsQlu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.