Nelsoncardoso / jquery-datatables-column-filter

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

Add case: dropdown for Twitter Bootstrap Dropdowns #118

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've written an additional function that you may wish to include in this 
plugin. It adds the option to have a twitter-bootstrap dropdown as an option 
filter. The dropdowns look something like this: http://d.pr/i/g1OE

Here's the code:

    function fnCreateDropdown(aData) {
        var index = i;
        var r = '<div class="dropdown select_filter"><a class="dropdown-toggle" data-toggle="dropdown" href="#">' + label + '<b class="caret"></b></a><ul class="dropdown-menu" role="menu"><li data-value=""><a>Show All</a></li>', j, iLen = aData.length;

        for (j = 0; j < iLen; j++) {
            r += '<li data-value="' + aData[j] + '"><a>' + aData[j] + '</a></li>';
        }
        var select = $(r + '</ul></div>');
        th.html(select);
        th.wrapInner('<span class="filterColumn filter_select" />');
        select.find('li').click(function () {
            oTable.fnFilter($(this).data('value'), index);
        });
    }

And near the bottom of the plugin code, you need to add the following case:

                        case "dropdown":
                            fnCreateDropdown(aoColumn.values);
                            break;

Original issue reported on code.google.com by thu...@gmail.com on 5 Apr 2013 at 6:36

GoogleCodeExporter commented 9 years ago
Hi, 

Twitter like dropdowns are included see 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk//twitter-bootstr
ap-dropdown.html

Regards,
Jovan

Original comment by joc...@gmail.com on 21 May 2013 at 12:22