Skip to content

[Feature] Make TrinaDropdownMenuFilter typed #160

@DMouayad

Description

@DMouayad

Proposal

Let's consider this use-case, I have a selection type column with complex data.
For example:

// This's a simple class for demonstration only

class Order {
  final String name;
  final DateTime date;

  const Order(this.name, this.date);

  @override
  String toString() {
    return name;
  }

  factory Order.random() {
    return Order(faker.lorem.word(), faker.date.dateTime());
  }
}

late final orders = List.generate(10, (i) => Order.random());

// in the gird columns

 TrinaColumn(
        title: 'Order',
        field: 'order',
        type: TrinaColumnType.selectWithFilters(
          orders,
          itemToValue: (item) => item.date,
          itemToString: (item) => item.name,
          menuFilters: [],
        ),
 ),

And When selecting an order from the dropdown list, I want to be able to filter those orders by their date.

Current behavior

With the current implementation, it'll be hard to achieve this in a simple way because we're restricted with only a Text field and a String value for the filter.

Feature Request

  • I want to be able to provide a custom UI for a specific filter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions