dotnetcore / BootstrapBlazor

A set of enterprise-class UI components based on Bootstrap and Blazor
https://www.blazor.zone
Apache License 2.0
2.45k stars 294 forks source link

Some features for Table component #2867

Closed cairabbit closed 8 months ago

cairabbit commented 8 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

The table component now is awesome and complicated. Usually, when allowing user to customize the functions by template, it might need more features for cusomization. Here is what I can see while using the Table component.

  1. The Table component allows user to add/edititems by setting properties. However, there is no AddTemplate. sometimes, the content of Addint an item is not the same as Editing an item. So it's better to have AddTemplate, whne the AddTemplate doesn't exists, then use EditTemplate.
  2. When using SearchModel, the filtering model type might be different to the table item type, so there should have another optional TFilter type, say Employee is the row item type with properties: (FirstName, LastName, DateOfBirth, Nationality [Countries] etc), the filter type might be: (NameSearchText, Age [ could be: Senior, Adult, Child, Baby ], Nationality [could be: China, New Zealand, Others]). hope we could allow user to customize the filtering model.
  3. the EditMode are good, could we have another option "Drawer"? so we can show the add/edit form at the right drawer. this is a popular option now.

This might be a bit too much. As some scenario might not need such features, in my option. the Table component can be split into two components, one is just for showing filtering/searching/sorting and results. The other one can have filtering/searching/sorting/add/edit/delete operations.

Thank you for all the hard work. I love this library.

Describe the solution you'd like

Some thoughts of possible solutions:

  1. split the Table component to Table, AdvanceTable (or DataManageTable?), the Table component is just for filtering/searching/sorting
  2. having optional AddTemplate in place
  3. adding support for separating Filter model type.
  4. adding support for showing add/edit form as drawer (usually right side)

Additional context

No response

bb-auto[bot] commented 8 months ago

@cairabbit Thank you for contacting us. We will give feedback later.

ArgoZhang commented 8 months ago

@cairabbit Thank you very much for your suggestion.

AddTemplate

We can add a new template AddTemplate

SearchMode

https://www.blazor.zone/table/search#CustomerSearchModel

<Table TItem="Foo" CustomerSearchModel="@CustomerSearchModel" ShowSearch="true">
    <TableColumns>
        <TableColumn @bind-Field="@context.DateTime" Width="180" />
    </TableColumns>
    <CustomerSearchTemplate>
        @if (context is FooSearchModel model)
        {
            <FooSearch @bind-Value="@model" />
        }
    </CustomerSearchTemplate>
</Table>

Separate table

This component library has been around for over four years now, and it is very difficult to separate tables. Many old users find it difficult to accept this change

Drawer Mode

This is a good idea. We should implement this model

public enum EditMode
{
    /// <summary>
    /// 弹窗式编辑模式
    /// </summary>
    Popup,

    /// <summary>
    /// 行内编辑模式
    /// </summary>
    EditForm,

    /// <summary>
    /// 单元格内编辑模式
    /// </summary>
    InCell,

    /// <summary>
    /// 抽屉编辑模式
    /// </summary>
    Drawer
}