jhou2 / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

Select List's Don't Populate Values #124

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
We implemented DataTables for ASP.Net MVC page with an handler action method 
that returns Json data exampled below.

{"sEcho":"6","iTotalRecords":73,"iTotalDisplayRecords":73,"aaData":[["5","Test",
"Test","DonanimTest","HP","HP ProLiant 1","8 ₺","Müsait","6","item_shelve, 
use, reservation, item_warranty, "],["8","12345","Deneme","Geçici 
AssetType","Dell","Server 2008 R2","5 ₺","Müsait","","item_shelve, use, 
reservation, item_warranty, "],["9","1342","Deneme","Geçici 
AssetType","Dell","Server 2008 R2","5 $","Serviste","","unwarranty, "]}

Also we implemented datatable like below.
 var oTable = $('#datatables').dataTable({
                "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
                "sPaginationType": "bootstrap",
                "bServerSide": true,
                "bFilter": true,
                "bLengthChange": false,
                "bSort": true,
                "sAjaxSource": "/AssetItem/AjaxHandler",
                "bProcessing": true,
                "iDisplayLength": 50,
                "bAutoWidth": false,
                "bStateSave": true,
                "sOrdering": true,
                "aLengthMenu": [[5, 10, 25, 50], [5, 10, 25, 50]],
                "aoColumns":
                    [
                        {  
                            "sName": "AssetItemID",
                            "sWidth": "50px"
                        },
                        {  
                            "sName": "ServiceTag"
                        },
                         {
                             "sName": "Name"
                         },
                        {  
                            "sName": "Model.AssetType.Name"
                        },
                        {  
                            "sName": "Brand.Name"
                        },
                        {  
                            "sName": "Model.Name"
                        },
                        {  
                            "sName": "Price"
                        },
                        {  
                            "sName": "CurrentStatus"
                        },                                               
                        {
                            "bSearchable": false,
                            "bSortable": false
                        }
                    ],
                "aoColumnDefs": [
                       {
                           "aTargets": [8],
                           "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {

                               var actions = '<div class="btn-group">';
                              // some codes for buttons at row level

                               $(nTd).empty();
                               $(nTd).prepend(actions);
                           }
                       }],
                "fnDrawCallback": function (oSettings) {
                    var anControl = $('input', oSettings.aanFeatures.f);
                    $("tbody").highlight(anControl.val());
                }
            }).fnFilterOnReturn().columnFilter({
                aoColumns: [null,
                         { type: "text" },
                         { type: "text" },
                         { type: "select" },
                         { type: "select" },
                         { type: "select" },
                         null,
                 { type: "select" },
                 null
                ]

            });

What is the expected output? What do you see instead?
We expected to see populated select boxes for some colums and textboxes for 
others. Select boxes and textboxes inserted as expected but select boxes don't 
have any value except placeholder text as column header. 

What version of the product are you using? On what operating system?
Datatables 1.9.4 and column filter last version.
Windows 8

Please provide any additional information below.

Original issue reported on code.google.com by bahadira...@gmail.com on 21 May 2013 at 8:14

GoogleCodeExporter commented 8 years ago
I just noticed something, do we have to populate select values with static 
codes?

i thought, it will summarize select options from datatables values at specified 
column.

Original comment by bahadira...@gmail.com on 21 May 2013 at 12:57

GoogleCodeExporter commented 8 years ago
I think i found the problem but couldn't find a solution yet.

DataTables, _fnAddData function called after columnFilter initialization; 
because of this fnSettings.aiDisplayMaster array is empty.

How can i force columnFilter init to work after datatable's _fnAddData function?

Original comment by bahadira...@gmail.com on 21 May 2013 at 1:47