Skip to main content

PivotContextMenuProvider

Trait PivotContextMenuProvider 

Source
pub trait PivotContextMenuProvider: 'static {
    // Required method
    fn menu_items(
        &self,
        request: &PivotContextMenuRequest,
    ) -> Vec<PivotMenuItem>;

    // Provided method
    fn on_action(
        &self,
        action_id: &str,
        request: &PivotContextMenuRequest,
        state: &mut PivotState,
        cx: &mut App,
    ) { ... }
}
Expand description

Trait implemented by consumers to supply custom right-click menu items for the pivot and handle clicks on them.

Register on crate::grid::SqllyDataTableBuilder::pivot_context_menu_provider (or crate::grid::SqllyDataTable::set_pivot_context_menu_provider). When registered, the provider fully controls the menu; compose the built-in actions via PivotMenuItem::standard_items or the individual constructors. Items carrying the built-in pivot.* ids are executed by the pivot itself and do not reach PivotContextMenuProvider::on_action.

Required Methods§

Source

fn menu_items(&self, request: &PivotContextMenuRequest) -> Vec<PivotMenuItem>

Build the menu items for the given right-click context. Return an empty vec to suppress the menu for this target.

Provided Methods§

Source

fn on_action( &self, action_id: &str, request: &PivotContextMenuRequest, state: &mut PivotState, cx: &mut App, )

Handle a click on a custom action item. action_id matches the id supplied in PivotMenuItem::Action.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§