网格过滤器不适用于多个值

时间:2013-02-05 11:32:33

标签: php javascript jquery datasource kendo-ui

我对此网格上的过滤器有疑问:

网格声明:

            >$("#grid2").kendoGrid({
                dataSource: {
                    transport: {
                        read: "datos/CargarTipo_Impresion_s.php" //php file with mysql sentence
                    },
                    batch: true,
                    schema: {
                        model: 
                            id: "notipoimpresion",
                            fields: 
                                notipoimpresion: { type: "number" },
                                descripcion: { type: "string" },
                                nogrupo: { type: "number" },
                            }
                        }
                    },
                    //send notipoimpresion like parameter to the page : CargarTipo_Impresion_s.php
                    serverFiltering: true,
                    //filter: { field: "notipoimpresion", operator: "eq", value: "1,2" }, // with this filter is ok, show data
                    //filter: { field: "notipoimpresion", operator: "eq", value: 2 }, //with this filter is ok , show data
                    //filter: { field: "notipoimpresion", operator: "eq", value: '1,2' }, //with this filter is ok, show data

                    filter: { field: "notipoimpresion", operator: "eq", value: value_codigos_tipo_impresion }, //with this filter doesn´t show data
                    //value_codigos_tipo_impresion, can have this values: "1" or "1,2" or "1,2,4", etc.
                   //value_codigos_tipo_impresion, receive the value from a form text

在CargarTipo_Impresion_s.php中使用此:

  

$ codigos_tipo_impresion = mysql_real_escape_string($ _ REQUEST [“filter”] [“filters”] [0] [“value”]);

并执行一个mysql句子

在php变量的其他例子中工作!

  

filter:{field:“notipoimpresion”,operator:“eq”,value:“?php var_codigos_tipo_impresion;?” },

当$ var_codigos_tipo_impresion:可以有值:“1”,“1,2”,“1,2,3·等......”

有人能告诉我,为什么不制作过滤器?或者有什么问题?

感谢
JC

1 个答案:

答案 0 :(得分:0)

示例和解决方案:代码更正和版本KendoUI CSS和JavaScript:v2012.3.1114

jsfiddle.net/jcpaquot/vJTwF/6] [1]

相关问题