0

我使用数据表和列过滤器插件来显示和过滤数据库中的数据。我实现了多选过滤复选框。我所能做的就是为复选框过滤器预定义值,但我需要复选框过滤器来自数据库的值。

jQuery('#tabela').dataTable({
                   "oLanguage": {
                   "sSearch": "Search:",
                   "sInfoFiltered": '' 
                    },
                   "bProcessing": true,
                   "bServerSide": true,
                   "sServerMethod": "GET",
                   "sAjaxSource": "server.php",
                   "fnServerParams": function(aoData) {
                                     aoData.push({"name" : "more_data", 
                                                 "value" : "my_value"})
                          },
                   "bJQueryUI": true
                   }).columnFilter({
                              aoColumns: [
                                         { type: "checkbox", 
                                           values: ["Filter Cola 1", 
                                           "FIlter Cola 2", "FIlter Cola 3"]},
                                         {},
                                         { type: "checkbox",
                                           values: ["Filter Colc 1", 
                                           "FIlter Colc 2","FIlter Colc 3"]}
                              ]
                    });

如何从服务器端设置复选框过滤器值?

4

1 回答 1

0
jQuery('#tabela').dataTable({
                   "oLanguage": {
                   "sSearch": "Search:",
                   "sInfoFiltered": '' 
                    },
                   "bProcessing": true,
                   "bServerSide": true,
                   "sServerMethod": "GET",
                   "sAjaxSource": "server.php",
                   "fnServerParams": function(aoData) {
                                     aoData.push({"name" : "more_data", 
                                                 "value" : "my_value"})
                          },
                   "bJQueryUI": true
                   }).columnFilter({
                              aoColumns: [  { type: 'checkbox',
                        data: "{'Pending':'Pending','Complete':'Complete'}"// use like this type  i am just giving an idea use with your data it will work i used this way and it works

                                }

                              ]
                    });
于 2013-08-21T15:26:23.890 回答