fn update_filter_input(&self, val: String) {
        let mut filter = self.session.get_view_config().filter.clone();
        let filter_item = &mut filter.get_mut(self.idx).expect("Filter on no column");
        let filter_input = match filter_item.1 {
            FilterOp::In => Some(FilterTerm::Array(
                val.split(',')
                    .map(|x| Scalar::String(x.trim().to_owned()))
                    .collect(),
            )),
            _ => match self.get_filter_type() {
                Some(Type::String) => Some(FilterTerm::Scalar(Scalar::String(val))),
                Some(Type::Integer) => {
                    if val.is_empty() {
                        None
                    } else if let Ok(num) = val.parse::<f64>() {
                        Some(FilterTerm::Scalar(Scalar::Float(num.floor())))
                    } else {
                        None
                    }
                }
                Some(Type::Float) => {
                    if val.is_empty() {
                        None
                    } else if let Ok(num) = val.parse::<f64>() {
                        Some(FilterTerm::Scalar(Scalar::Float(num)))
                    } else {
                        None
                    }
                }
                Some(Type::Date) => match NaiveDate::parse_from_str(&val, "%Y-%m-%d") {
                    Ok(ref posix) => posix
                        .and_hms_opt(0, 0, 0)
                        .map(|x| FilterTerm::Scalar(Scalar::DateTime(x.timestamp_millis() as f64))),
                    _ => None,
                },
                Some(Type::Datetime) => match str_to_utc_posix(&val) {
                    Ok(x) => Some(FilterTerm::Scalar(Scalar::DateTime(x))),
                    _ => None,
                },
                Some(Type::Bool) => Some(FilterTerm::Scalar(match val.as_str() {
                    "true" => Scalar::Bool(true),
                    _ => Scalar::Bool(false),
                })),

                // shouldn't be reachable ..
                _ => None,
            },
        };

        if let Some(input) = filter_input {
            filter_item.2 = input;
            let update = ViewConfigUpdate {
                filter: Some(filter),
                ..ViewConfigUpdate::default()
            };

            self.update_and_render(update);
        }
    }
/// Update the filter value from the string input read from the DOM.
///
/// # Arguments
/// - `val` The new filter value.
Update the filter value from the string input read from the DOM.
Update the filter value from the string input read from the DOM .
fn update_filter_input(&self, val: String) {
        let mut filter = self.session.get_view_config().filter.clone();
        let filter_item = &mut filter.get_mut(self.idx).expect("Filter on no column");
        let filter_input = match filter_item.1 {
            FilterOp::In => Some(FilterTerm::Array(
                val.split(',')
                    .map(|x| Scalar::String(x.trim().to_owned()))
                    .collect(),
            )),
            _ => match self.get_filter_type() {
                Some(Type::String) => Some(FilterTerm::Scalar(Scalar::String(val))),
                Some(Type::Integer) => {
                    if val.is_empty() {
                        None
                    } else if let Ok(num) = val.parse::<f64>() {
                        Some(FilterTerm::Scalar(Scalar::Float(num.floor())))
                    } else {
                        None
                    }
                }
                Some(Type::Float) => {
                    if val.is_empty() {
                        None
                    } else if let Ok(num) = val.parse::<f64>() {
                        Some(FilterTerm::Scalar(Scalar::Float(num)))
                    } else {
                        None
                    }
                }
                Some(Type::Date) => match NaiveDate::parse_from_str(&val, "%Y-%m-%d") {
                    Ok(ref posix) => posix
                        .and_hms_opt(0, 0, 0)
                        .map(|x| FilterTerm::Scalar(Scalar::DateTime(x.timestamp_millis() as f64))),
                    _ => None,
                },
                Some(Type::Datetime) => match str_to_utc_posix(&val) {
                    Ok(x) => Some(FilterTerm::Scalar(Scalar::DateTime(x))),
                    _ => None,
                },
                Some(Type::Bool) => Some(FilterTerm::Scalar(match val.as_str() {
                    "true" => Scalar::Bool(true),
                    _ => Scalar::Bool(false),
                })),
                // shouldn't be reachable ..
                _ => None,
            },
        };
        if let Some(input) = filter_input {
            filter_item.2 = input;
            let update = ViewConfigUpdate {
                filter: Some(filter),
                ..ViewConfigUpdate::default()
            };
            self.update_and_render(update);
        }
    }
fn update_filter_input ( & self , val : String ) { let mut filter = self . session . get_view_config ( ) . filter . clone ( ) ; let filter_item = & mut filter . get_mut ( self . idx ) . expect ( " " ) ; let filter_input = match filter_item . 1 { FilterOp :: In => Some ( FilterTerm :: Array ( val . split ( ',' ) . map ( | x | Scalar :: String ( x . trim ( ) . to_owned ( ) ) ) . collect ( ) , ) ) , _ => match self . get_filter_type ( ) { Some ( Type :: String ) => Some ( FilterTerm :: Scalar ( Scalar :: String ( val ) ) ) , Some ( Type :: Integer ) => { if val . is_empty ( ) { None } else if let Ok ( num ) = val . parse :: < f64 > ( ) { Some ( FilterTerm :: Scalar ( Scalar :: Float ( num . floor ( ) ) ) ) } else { None } } Some ( Type :: Float ) => { if val . is_empty ( ) { None } else if let Ok ( num ) = val . parse :: < f64 > ( ) { Some ( FilterTerm :: Scalar ( Scalar :: Float ( num ) ) ) } else { None } } Some ( Type :: Date ) => match NaiveDate :: parse_from_str ( & val , " " ) { Ok ( ref posix ) => posix . and_hms_opt ( 0 , 0 , 0 ) . map ( | x | FilterTerm :: Scalar ( Scalar :: DateTime ( x . timestamp_millis ( ) as f64 ) ) ) , _ => None , } , Some ( Type :: Datetime ) => match str_to_utc_posix ( & val ) { Ok ( x ) => Some ( FilterTerm :: Scalar ( Scalar :: DateTime ( x ) ) ) , _ => None , } , Some ( Type :: Bool ) => Some ( FilterTerm :: Scalar ( match val . as_str ( ) { " " => Scalar :: Bool ( true ) , _ => Scalar :: Bool ( false ) , } ) ) , // shouldn't be reachable .. _ => None , } , } ; if let Some ( input ) = filter_input { filter_item . 2 = input ; let update = ViewConfigUpdate { filter : Some ( filter ) , .. ViewConfigUpdate :: default ( ) } ; self . update_and_render ( update ) ; } }
Update the filter value from the string input read from the DOM.
Update the filter value from the string input read from the DOM .
&self
val
String
&self
val
String
The new filter value.
The new filter value .