'have tabulator using a gz compressed json file without enabling compression on the web server

I can't change the web server so I can't enable compression on the .json file automatically. This would be my ideal solution.

I would like tabulator to pull down a json file that is compressed to a gz file, but I don't know if it's possible or what I would need to do in order to tell it to decompress it before trying to use it.

Is there a way to set the ajaxURL to gz and it work?

Thanks



Solution 1:[1]

You could use the ajaxResponse callback to take the incoming compressed data and then decompress it before passing it into Tabulator.

In this example im going to use the advice of this GZip Stack Overflow Question so you will need to copy the uncompress function from there

var table = new Tabulator("#exmaple-table", {
    ...other table config
    ajaxResponse:function(url, params, response){
        return uncompress(response);
    },
});

Full details of the ajaxResponse callback can be found in the Ajax Documentation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oli Folkerd