【问题标题】:YADCF range_number - is it possible to add a preset select list to to/from range?YADCF range_number - 是否可以向/从范围添加预设选择列表?
【发布时间】:2018-09-06 14:25:45
【问题描述】:

我想向/从 range_number 的字段添加一个选择列表,以便用户可以从设定的金额中选择设定范围。

【问题讨论】:

    标签: yadcf


    【解决方案1】:

    最好的选择是使用自定义函数过滤filter_type: 'custom_func'

    see showcase, first column,代码示例和所有内容都可以在该页面上找到

    {
        column_number: 0,
        filter_type: 'custom_func',
        custom_func: myCustomFilterFunction,
    

    ...

    (可能的)自定义函数实现

    function myCustomFilterFunction(filterVal, columnVal) {
        var found;
        if (columnVal === '') {
            return true;
        }
        switch (filterVal) {
        case 'happy':
            found = columnVal.search(/:-\]|:\)|Happy|JOY|:D/g);
            break;
        case 'sad':
            found = columnVal.search(/:\(|Sad|:'\(/g);
            break;
        case 'angry':
            found = columnVal.search(/!!!|Arr\.\.\./g);
            break;
        case 'lucky':
            found = columnVal.search(/777|Bingo/g);
            break;
        case 'january':
            found = columnVal.search(/01|Jan/g);
            break;
        default:
            found = 1;
            break;
        }
    
        if (found !== -1) {
            return true;
        }
        return false;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多