【问题标题】:Make ExtJS filter `int` type with `equal` comparison使用 `equal` 比较使 ExtJS 过滤器`int` 类型
【发布时间】:2012-11-22 09:48:02
【问题描述】:

我在一个旧的(不是我的)项目中使用ExtJS,我必须对其进行调试。
所以我在搜索表单中有这个代码:

var pm = Ext.getCmp('ddlFltrPM').getValue();
if(pm && pm > 0)    
filters.push({dataIndex: 'project_manager_id', type: 'string', value: pm});

这可行,但在 php 代码函数中,在 sql 查询中转换此过滤器,如下所示:
AND project_manager_id LIKE %...%(默认转换函数),因为它是 string 搜索字段。

但我需要精确匹配。 所以当我尝试这样的事情时:

var pm = Ext.getCmp('ddlFltrPM').getValue();
if(pm && pm > 0)    
filters.push({dataIndex: 'project_manager_id', type: 'int', comparison:'eq', value: pm});

..filter 不出现在 POST 中。我尝试了typecomparison 的许多变体,但没有任何效果。

那么如何通过eq 比较将此过滤字段更改为int

感谢您的建议。
斯坦尼斯拉夫。

【问题讨论】:

    标签: php extjs filter


    【解决方案1】:

    我解决了这个问题。但是逐步调试 ExtJS 代码很困难。所以代码:

    var pm = Ext.getCmp('ddlFltrPM').getValue();
    if(pm && pm > 0)    
    filters.push({dataIndex: 'project_manager_id', type: 'int', value: {"eq":pm}});
    

    【讨论】:

    • 不错的解决方案。你知道你可以接受你自己的答案;)?
    • @A1rPun 你知道吗,最近才 21 小时? ;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-24
    • 2015-10-02
    • 2021-08-13
    • 1970-01-01
    相关资源
    最近更新 更多