jQuery UI Widgets Forums Grid Beginner: Grid, Dataadapter and Paging

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Beginner: Grid, Dataadapter and Paging #46343

    fbrem
    Participant

    Hi there,

    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' },
            ]
        });
    Beginner: Grid, Dataadapter and Paging #46345

    Peter Stoev
    Keymaster

    Hi fbrem,

    If you get all the data, why do you need to enable virtualmode at all? It’s appropriate for scenarios with many thousands/millions of data records, but I don’t think that it is reasonable to download all that data on the client at once.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Beginner: Grid, Dataadapter and Paging #46346

    fbrem
    Participant

    Hi Peter,

    i don’t understand your question. I don’t get any data, the GET-call fails because of the included parameters

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

    How do i get rid of them?

    Beginner: Grid, Dataadapter and Paging #46392

    fbrem
    Participant

    I got an answer to this question on stackoverflow (http://stackoverflow.com/questions/20537014/jqwidgets-jqxgrid-dataadapter-and-paging) In the dataadapter include:

    formatData: function (data) {
                return {};
            },

    and in the source:

    cache: true

    Beginner: Grid, Dataadapter and Paging #46394

    Peter Stoev
    Keymaster

    Hi fbrem,

    Thanks for the update!

    The answer there is from us, too 🙂

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.