Responsive extension not working with datatables when configured for serverside

Responsive extension not working with datatables when configured for serverside

azhar_iqbalazhar_iqbal Posts: 1Questions: 1Answers: 0
edited September 2019 in Free community support

I have two methods for building a dtOptions object:
BuildBasicDtOptions - It relies on client side data and the responsive extension works with this method.
GetDtOptions - this one uses http to retrieve data from a web service - the responsive extension does not work.

I'm not using the columns collection in either method, instead I'm populating the data manually in a html file using an ngFor loop.

In the GetDtOptions callback method I set the data to a blank array to prevent blank rows from appearing and I have a hunch this is what is causing the problem (or the fact that I'm manually rendering the rows in the table). I don't know how to resolve this issue. Any help will be much appreciated.

    public GetDtOptions(config: DataTableConfig): any {
...

        var dtOptions: any = {
...
            serverSide: true,
            processing: true,
            ordering: false,
            searching: false,
            responsive:true,
            ajax: (tableOptions: any, callback) => {
                that.http
                    .post<DataTableResponse>(getUrl(), getUserparam(tableOptions), {})
                    .subscribe(resp => {
                        config.callback.next(resp.data);
                        callback({
                            recordsTotal: resp.recordsTotal,
                            recordsFiltered: resp.recordsFiltered,
                            data: []
                        });
                    });
            },
...
        };

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @azhar_iqbal ,

    There's no known issues with Responsive and serverSide. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.