Change the length selection to Bootstrap 2

Change the length selection to Bootstrap 2

aswissaswiss Posts: 0Questions: 0Answers: 0
edited July 2012 in General
Hi everybody!

i like to change the default length selecton to a Bootstrap 2 dropdown but i can't switch the jQuery-bindings to it. The bindings should be on the hidden input field, cause there I put the selected number from the dropdown.

I tried to change the length variable, when the change event got trigged, and then I called the redraw function. This method didn't produce the desired results ...

I hope I've described it clearly and someone can help me :-)

[code]
$.fn.DataTable.defaults["fnDrawCallback"] = function () {
$('.dataTables_length select').each(function(i, e){
if (!($(e).data('convert') == 'no')) {
$(e).wrap('');
var select = $('#select-group-' + i);
var current = ($(e).val()) ? $(e).val(): ' ';
select.html('' + current + '');
$(e).find('option').each(function(o,q) {
select.find('.dropdown-menu').append('' + $(q).text() + '');
if ($(q).attr('selected')) select.find('.dropdown-menu li:eq(' + o + ')').click();
});
select.find('.dropdown-menu a').click(function() {
select.find('input[type=hidden]').val($(this).data('value')).change();
select.find('.btn:eq(0)').text($(this).text());
});
}
});
}
[/code]

Greets
aswiss
This discussion has been closed.