Question

i have a newbie question, but i’m scratching my head on this one. I have a grid, bound to a dataadapter. On the grid, paging and filtering is explicit disabled, but the GET-call from the dataadapter allways includes following parameters in the GET-url:

?filterscount=0&groupscount=0&pagenum=0&pagesize=10&recordstartindex=0&recordendindex=18&_=1386768031615

I want to get all data, then cache it clientside for paging and filtering, but in the first step i just want to get my data bound to the grid.

Here’s my code:

var source = {
    type: "GET",
    datatype: "json",
    datafields: [
        { name: 'url' },
        { name: 'category', type: 'int' },
        { name: 'info' },
        { name: 'status', type: 'bool' }
    ],
    url: '/api/redirects/Getallredirects',
    id: 'id'
};

var dataAdapter = new $.jqx.dataAdapter(source, {
    contentType: 'application/json; charset=utf-8',
    loadError: function (xhr, status, error) {
        alert(error);
    },
    downloadComplete: function (data) {
        var returnData = {};
        returnData.records = data.d;
        return returnData;
    }
});

$("#jqxgrid").jqxGrid({
    source: dataAdapter,
    filterable: false,
    pageable: false,
    virtualmode: false,
    columns: [
        { text: 'URL', dataField: 'url', width: 100 },
        { text: 'Category', dataField: 'category', width: 100 },
        { text: 'Info', dataField: 'info', width: 180 },
        { text: 'Status', dataField: 'status', width: 80, cellsalign: 'right' },
    ]
});

I don’t get any data, the GET-call fails because of the automatically included parameters. How do i get rid of these parameters?

I just found in the jqxGrid documentation a reference to these parameters, but no example, how to remove them:

http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-extra-http-variables.htm

Thanks in advance for any help.

Was it helpful?

Solution

The below will remove the default parameters:

var dataAdapter = new $.jqx.dataAdapter(source,
    {
        formatData: function (data) {
            return {};
        }
    }
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top