0

How can I change my Datatable's language? This code is working but I want to change the language of otable. basically my issue is that when i change language than otable.columns() evnt is not working and when i use var otable = $('#grdFormlist').DataTable(); than change language is not working

var otable = $('#grdFormlist').DataTable();

 otable.columns().every(function () {
                    var that = this;
                    $('input', this.footer()).on('keyup change', function () {
                        if (that.search() !== this.value) {
                            that
                                .search(this.value)
                                .draw();
                        }
                    });
                });

otable = $('#grdFormlist').DataTable({
  "language": {
    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"
  }
});
2
  • otable !== oTable (capital T) Commented Feb 25, 2019 at 12:46
  • man i want to change language by using this variable otable.language like something Commented Feb 25, 2019 at 12:51

1 Answer 1

1

Thanks every one my issue solved by using timeout.

var otable = $('#grdFormlist').DataTable({
                    "language": {
                        "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"
                    }
                });
                setTimeout(function () {
                    otable.columns().every(function () {
                        var that = this;
                        $('input', this.footer()).on('keyup change', function () {
                            if (that.search() !== this.value) {
                                that
                                    .search(this.value)
                                    .draw();
                            }
                        });
                    });
                },3000)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.