Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35297

initComplete

$
0
0

Could someone help out. I have two pieces of code one works the other one doesn't.

Works:

$('#results').DataTable({
            "initComplete": function(settings, json) {
                $.each(json.data, function(index, value) {
                    $("#company").append('<option value="' + value.bank + '" selected="selected">' + value.bank + '</option>');
                    $("#frequency").append('<option value="' + value.provider + '" selected="selected">' + value.provider + '</option>');
                });

                $("#frequency").multipleSelect({
                    filter: true,
                    onUncheckAll: function() {
                        table.column(4).search("none", true).draw();
                    },
                    onCheckAll: function() {
                        table.column(4).search('').draw();
                    },
                    onClick: function() {
                        var value = "(";
                        $("ul li.selected").each(function(index, val) {
                            value += "(" + $(val).find('input').val() + ")|";
                        });
                        if (value == "(") {
                            value = "";
                        } else {
                            value = value.slice(0, -1);
                            value += ")";
                        }
                        table.column(4).search(value, true).draw();
                    }
                });

                $("#company").multipleSelect({
                    filter: true,
                    onUncheckAll: function() {
                        table.column(0).search("none", true).draw();
                    },
                    onCheckAll: function() {
                        table.column(0).search('').draw();
                    },
                    onClick: function() {
                        var value = "(";
                        $("ul li.selected").each(function(index, val) {
                            value += "(" + $(val).find('input').val() + ")|";
                        });
                        if (value == "(") {
                            value = "";
                        } else {
                            value = value.slice(0, -1);
                            value += ")";
                        }
                        table.column(0).search(value, true).draw();
                    }
                });
            }

However if I move the code into a function, it doesn't like this

$('#results').DataTable({
            "initComplete": function(settings, json) {
                setupFilter(json);
            }

The web page:
[retracted]

select Russia, RUB and amount 121 to get some results.


Viewing all articles
Browse latest Browse all 35297

Trending Articles