Skip to main content

EditPolicy

Trait EditPolicy 

Source
pub trait EditPolicy: 'static {
    // Required methods
    fn on_blur(&self, context: &EditPolicyContext<'_>) -> EditEnd;
    fn on_value_change(&self, context: &EditPolicyContext<'_>) -> DraftAction;
    fn on_hidden(&self, context: &EditPolicyContext<'_>) -> EditEnd;

    // Provided methods
    fn commit_unchanged(&self) -> bool { ... }
    fn settle_timeout(&self) -> Duration { ... }
    fn error_mark_timeout(&self) -> Option<Duration> { ... }
}
Expand description

How an edit session behaves around its commit and under live data. Asked once per event on the UI thread.

The default is StandardEditPolicy.

Required Methods§

Source

fn on_blur(&self, context: &EditPolicyContext<'_>) -> EditEnd

The focus left an open editor, or a press landed outside it.

Source

fn on_value_change(&self, context: &EditPolicyContext<'_>) -> DraftAction

The edited cell’s value changed in the store.

Source

fn on_hidden(&self, context: &EditPolicyContext<'_>) -> EditEnd

The edited row left the shown lines without a user action: a filter, a collapsed group.

Provided Methods§

Source

fn commit_unchanged(&self) -> bool

Returns true if a commit equal to the value the edit started from still emits EditCommit. Default: no, the editor closes with EditCancel { reason: Unchanged }.

Source

fn settle_timeout(&self) -> Duration

How long an accepted value is shown while the store does not have it yet. Default: 5 s.

Source

fn error_mark_timeout(&self) -> Option<Duration>

How long the error mark of a failed commit stays; None (the default): until the cell is edited again or LiveGridState::clear_edit_error.

Implementors§