Skip to main content

JsActionHandler

Trait JsActionHandler 

Source
pub trait JsActionHandler {
    // Required methods
    fn on_keystroke(
        &mut self,
        tree: &mut FieldTree,
        field_id: FieldId,
        change: &str,
        js: &str,
    ) -> bool;
    fn on_validate(
        &mut self,
        tree: &mut FieldTree,
        field_id: FieldId,
        js: &str,
    ) -> bool;
    fn on_format(
        &mut self,
        tree: &FieldTree,
        field_id: FieldId,
        js: &str,
    ) -> Option<String>;
    fn on_calculate(
        &mut self,
        tree: &mut FieldTree,
        field_id: FieldId,
        js: &str,
    ) -> Option<String>;
}
Expand description

Callback interface for an external JavaScript engine.

Required Methods§

Source

fn on_keystroke( &mut self, tree: &mut FieldTree, field_id: FieldId, change: &str, js: &str, ) -> bool

Called on keystroke events (/K). Returns true if accepted.

Source

fn on_validate( &mut self, tree: &mut FieldTree, field_id: FieldId, js: &str, ) -> bool

Called on validate events (/V). Returns true if valid.

Source

fn on_format( &mut self, tree: &FieldTree, field_id: FieldId, js: &str, ) -> Option<String>

Called on format events (/F). Returns formatted display string.

Source

fn on_calculate( &mut self, tree: &mut FieldTree, field_id: FieldId, js: &str, ) -> Option<String>

Called on calculate events (/C). Returns calculated value.

Implementors§