We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Phalcon Datatables performance


I'm using Phalcon Datatables and the adapter is really good. In general when we are loading a table with a phalcon paginator (without datatables lib) the display of the table is really fast. But with Phalcon datatables adapter (of course it's faster than the JQuery datatables library) the display of the table isn't instant.

Do you know a library like Phalcon datatables more optimized than my current lib ? Because I want to keep the Phalcon's performance.



this is what I use : https://js-grid.com/

just implement the "getting data" youtself and you will be fine

It looks very nice. There is server-side too ?


yep, you can make it dirty but instant, or ajax call to the backend

Ok thanks. Just a question. What did you mean about "getting data".


to implement the backend site, the php queries, format it to correct way. I actually have ready code at work, tomorrow if i still remember will post it here

Hi Izo, could you post your code please ? I want to close this thread. Thanks.


man i forgot about you ...

here is the JS

                height: 'auto',
                width: "100%",

                sorting: false,
                autoload: true,

                paging: true,
                pageSize: 10,
                pageButtonCount: 5,
                pagerContainer: "#externalPager",
                pagerFormat: "current page: {pageIndex}    {first} {prev} {pages} {next} {last}    total pages: {pageCount}",
                pagePrevText: "<",
                pageNextText: ">",
                pageFirstText: "<<",
                pageLastText: ">>",
                pageNavigatorNextText: "&#8230;",
                pageNavigatorPrevText: "&#8230;",
                deleteConfirm: function(item) {
                    return "The client \"" + item.Name + "\" will be removed. Are you sure?";
                rowClick: function(args) {
                    showDetailsDialog("Edit", args.item);
                controller: {
                    loadData: function(filter) {

                        var d = $.Deferred();
                                type: "GET",
                                url: "/api/menu/loadItems",
                                dataType: "json",
                                data: filter,
                            }).done(function(response) {

                        return d.promise();
                    insertItem: function(item) {
                        return $.ajax({
                            type: "POST",
                            url: "/clients/",
                            data: item
                    updateItem: function(item) {
                        return $.ajax({
                            type: "PUT",
                            url: "/clients/",
                            data: item
                    deleteItem: function(item) {
                        return $.ajax({
                            type: "DELETE",
                            url: "/clients/",
                            data: item
                fields: [
                    { name: "name", type: "text", width: 150 },
                    { name: "languages", type: "text", width: 50 },
                        type: "control",
                        modeSwitchButton: false,
                        editButton: false,
                        headerTemplate: function() {
                            return $("<button>").attr("type", "button").text("Add")
                                .on("click", function () {
                                    showDetailsDialog("Add", {});

well in the backend, there is nothing special.

$data['data'] = MyApp\menu\Models\Menus::find()->toArray();

        foreach ($data['data'] AS &$res){

            //perfeform some changes if even neederd

        $data['itemsCount'] = count($data['data']);

        echo json_encode($data);exit;

Thanks a lot man. I'll try this lib next time and I'll tell you if this is better than Jquery Datatables.

I tried JsGrid server side and this is the same behavior as datatables. Of course this is fast but the table display is not really instant. I'll try to write into the file db.js and display it into the table.

Ok this is not the good way. Write into the db.js is too slow when we have lot of data.


you cnat be expecting instant result when there are tons of data, it doesnt make sence. If your query takes 5 secs, no matter what plugin you will use will make the display instant :-)