Author Topic: remote sorting not working after upgrading to v5.6  (Read 1643 times)

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
remote sorting not working after upgrading to v5.6
« on: December 18, 2018, 01:28:23 am »
Hi pqTeam,

I recently upgraded to v5.6, and the sorting is not working anymore in an Infinite Scrolling scenario.

Here is the grid code:
Code: [Select]

        var obj = {
            sortModel: { type: 'remote', sorter: [{ dataIndx: 'AuditID', dir: 'down' }] },
            numberCell: { show: false },
            filterModel: { on: true, header: true, type: 'remote' },
            showTop: false,
            menuIcon: true,
            menuUI: {
                tabs: ['filter']
            },
            height: 500,
            flex: { one: true },
            wrap: false,
            freezeCols: 1,
            editable: false,
            collapsible: false,
            resizable: true,
            // Callback Functions:
            beforeSort: function (evt) {
                if (evt.originalEvent) {//only if sorting done through header cell click.
                    pqIS.init();
                }
            },
            beforeFilter: function () {
                pqIS.init();
            },
            beforeTableView: function (evt, ui) {
                var finalV = ui.finalV,
                    data = pqIS.data;
                if (ui.initV == null) {
                    return;
                }
                if (!pqIS.pending && finalV >= data.length - 1 && data.length < pqIS.totalRecords) {
                    pqIS.requestPage++;
                    pqIS.pending = true;
                    //request more rows.
                    this.refreshDataAndView();
                }
            }
        };

        obj.colModel = [
            {
                title: "Audit ID", dataIndx: "AuditID", minWidth: "90", dataType: 'integer',
                render: function (ui) { return { style: "text-decoration: underline;", text: "<a href='/Audits/Details/" + ui.cellData + "'>" + ui.cellData + "</a>" } },
                filter: { crules: [{ condition: 'equal' }], listener: 'change' }
            },
            {
            .....

And the dataModel:

Code: [Select]
obj.dataModel = {
            dataType: "JSON",
            location: "remote",
            url: '@Url.Action("AuditInfiniteData", "Audits")',
            postData: function () {
                return {
                    pq_curpage: pqIS.requestPage,
                    pq_rpp: pqIS.rpp,
                };
            },
            getData: function (response) {
                var data = response.data,
                    len = data.length,
                    curPage = response.curPage,
                    pq_data = pqIS.data,
                    init = (curPage - 1) * pqIS.rpp;
                pqIS.pending = false;
                pqIS.totalRecords = response.totalRecords;
                for (var i = 0; i < len; i++) {
                    pq_data[i + init] = data[i];
                }
                return { data: pq_data }
            }
            //,
            //error: function (jqXHR, textStatus, errorThrown) {
            //    //alert("There has been an error.\nPlease contact Orlando Acevedo at [email protected].\nERROR: " + errorThrown);
            //    alert("There has been an error.\nPlease contact Orlando Acevedo at [email protected].\nERROR: " + errorThrown);
            //}
        };

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: remote sorting not working after upgrading to v5.6
« Reply #1 on: December 18, 2018, 12:00:30 pm »
From which version have you upgraded your code?

Apparently your code looks fine. Do you get any error in the browser console or in your remote script.

There is no change and no known issue in remote sorting, it works fine in infinite scrolling demo:

https://paramquery.com/pro/demos/infinite_scroll
« Last Edit: December 18, 2018, 12:59:53 pm by paramquery »