Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBGrid requirements #243

Closed
8 of 15 tasks
MarkStega opened this issue Sep 1, 2020 · 4 comments
Closed
8 of 15 tasks

MBGrid requirements #243

MarkStega opened this issue Sep 1, 2020 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@MarkStega
Copy link
Member

MarkStega commented Sep 1, 2020

MBGrid Phase 1

  • Horizontal & vertical scrolling keeping column headers in view
  • Grouping with a separate template for the group names
  • Individual column templates, some data will be graphical
  • Ability to visually suppress columns (i.e. the 'group by' column)
  • Need to update backing data (as little as one column of one row and get a smooth refresh)
  • Fixed width column
  • 'Fit to data' column width
  • Multi column sorting

MBGrid Phase 2

  • Material styling
  • Density support

MBGrid Phase 3 Candidates

  • Column filtering - Filter methods for common datatypes (string & numeric) and extension custom filter dialog, details TBD
  • Column render fragments
  • Dynamic 'fit to content'
  • Move all data manipulation (Sorting, grouping, etc.) to the responsibility of the grid 'owner'
  • Virtualization
@MarkStega MarkStega changed the title MTDataTable requirements MTGrid requirements Sep 4, 2020
@stefanloerwald
Copy link
Collaborator

stefanloerwald commented Sep 5, 2020

I'd like to add filtering to the wishlist. Ideally, this would include a set of filter methods for common datatypes (string and numerical data) and the ability to extend that with a custom filter dialog and method (I need to work out a nice way to integrate custom filtering, not sure about the syntax yet).

[MS - 2020-09-05] Added requirement bullet with details TBD

@stefanloerwald
Copy link
Collaborator

Thinking about the custom filter menu:

The user should not be required to write a menu component and should not have to deal with how to open/close the menu. All they should provide is the content of the menu.
What they need for that is

  • context about what is available to display
  • some means to indicate back to the grid component that the table should be filtered by a particular predicate

I'm fairly sure we can design it roughly like this, so that usage looks like:

<Column Header="Column with customized filter">
   <CustomFilterMenuContent>
      @foreach (var item in context.Items)
      {
         <MTCheckbox Value="context.IsVisible(item)"
               ValueChanged="(visible) => { UpdateFilter(context, item, visible); }"/>
      }
   </CustomFilterMenuContent>
</Column>
@code {
  private List<TItem> my_visible_items = new List<TItem>();
  private void UpdateFilter(ColumnFilterContext<TItem> context, TItem item, bool visible)
  {
      if (visible) 
      {
         my_visible_items.Add(item);
      }
      else
      {
         my_visible_items.Remove(item);
      }
      // this is how we could update the filter: we replace the filter predicate
      context.IsVisible = (i) => my_visible_items.Contains(i);
  }
}

This of course is a rather boring filter menu (simply listing all items? come on!)

A more interesting one could be

<Column Header="SomeValue">
   <CustomFilterMenuContent>
      <MTNumericDoubleField Value="threshold"
            ValueChanged="(v) => {threshold = v;  context.IsVisible = (i) => { i.SomeValue > threshold; }; } />
   </CustomFilterMenuContent>
</Column>
@code {
  private double threshold;
}

So I think the definition could be:

public class ColumnFilterContext<TItem>
{
   public IEnumerable<TItem> Items { get; } //  to think about: is IEnumerable a good choice here?
   public Func<TItem, bool> IsVisible { get; set; } = (_) => true; // default state is to have everything visible
}

And for the column:

public partial class Column
{
    [Parameter] public string Header {get;set;}
    [Parameter] public RenderFragment<ColumnFilterContext<TItem>> CustomFilterMenuContent {get;set;}
    //...
}

Disclaimer: none of this code is tested. It wasn't even compiled once, so might contain syntax errors and other issues.

@simonziegler simonziegler added the enhancement New feature or request label Sep 14, 2020
@simonziegler
Copy link
Member

Is there anything in ASP.NET rc 1 that should be used to enhance a grid? E.g. Virtualize

@MarkStega MarkStega changed the title MTGrid requirements MBGrid requirements Nov 12, 2020
@MarkStega MarkStega modified the milestones: Backlog, v2.n.0 Jan 18, 2021
@MarkStega MarkStega modified the milestones: Backlog, vNext, v2.0.0 Oct 28, 2021
@MarkStega
Copy link
Member Author

Closing as the path forward is in MBGridMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants