网格过滤器没有´t使用多个值

Grid filter doesn´t work with multiples values

本文关键字:过滤器 #180 网格      更新时间:2023-09-26

我对这个网格上的过滤器有问题:

网格声明:

            >$("#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_eescape_string($_REQUEST["filter"]["filters"][0]["value"]);

并执行mysql语句

在另一个例子中,php变量有效

过滤器:{字段:"notipoimpresion",运算符:"eq",值:"?php var_codigos_tipo_impresion;?"},

当$var_codigos_tipo_impresion:可以具有值:"1"、"1,2"、"1、2、3·等…

有人能告诉我,为什么不做过滤器吗?或者出了什么问题

谢谢
JC

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

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