jQWidgets Forums

jQuery UI Widgets Forums Grid JqxGrid Paging last row Shows Null records

This topic contains 5 replies, has 2 voices, and was last updated by  Nadezhda 10 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • jishnu2026
    Participant

    After Using JqxGrid Paging The Last Row numer Shows Null or empty rows and my code shown below

    var source =
    {
    localdata: jsonsearch,
    datatype: “json”,
    datafields: [
    {name:’Fullname’},
    {name:’Age’},
    {name:’Address’}
    ],
    id:’id’,
    root:’Rows1′,
    type: ‘POST’,
    beforeprocessing: function (data) {
    var ParsData = JSON.parse(data);
    source.totalrecords = ParsData.TotalRows1;
    },
    };

    -Petapoco as ORM [MVC].
    Paging Working Fine in Page number 1,2,3….. [Last-1]
    Problem only in Last Page.
    How to solve this error


    Nadezhda
    Participant

    Hello jishnu2026,

    This code is insufficient for us to determine the source of the issue. Please, provide us with a larger code sample.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/


    jishnu2026
    Participant

    This is my complete Code
    var searchpgno = 1;
    var ppagesize = 10;

    function GetSearch()
    {
    var url1 = ‘/customer/Search/?searchpgno=’ + searchpgno +’&pagesize=’+ppagesize;
    var jsonsearch;
    $.ajax({
    type: ‘POST’,
    url: url1,
    async: false,
    success: function (data) {
    if (data == ”) {

    }
    else {
    jsonsearch = data;
    }
    },
    error: function (response) {
    alert(response.error)
    }
    });

    var source =
    {
    localdata: jsonsearch,
    datatype: “json”,
    datafields: [
    {name:’Fullname’},
    {name:’Age’},
    {name:’Address’}
    ],
    id:’id’,
    root:’Rows1′,
    type: ‘POST’,
    beforeprocessing: function (data) {
    var ParsData = JSON.parse(data);
    source.totalrecords = ParsData.TotalRows1;
    },
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxCustomerSearch”).jqxGrid(
    {
    source: dataAdapter,
    editable: false,
    autoheight: false,
    sortable: true,
    height: 455,
    width: 500,
    rowsheight: 55,
    theme: theme,
    columnsresize: true,
    showemptyrow: true,
    selectionmode: ‘singlerow’,
    pageable: true,
    virtualmode: true,
    pagermode: ‘default’,
    rendergridrows: function (obj) {
    return obj.data;
    },
    pagerheight: 45,
    columns: [
    { text:’Full Name’, datafield: ‘Fullname’, width: ‘6%’},
    { text: ‘Age’, datafield: ‘Age’, width: ‘12%’ },
    { text: ‘Address’, datafield: ‘Address’, width: ‘18%’ },
    { text: AHouse, datafield: ‘cHouse’, width: ‘13%’ },

    ]
    });
    // End – Setup Data Grid

    }

    $(‘#jqxCustomerSearch’).on(‘pagechanged’, function (event) {
    var args = event.args;
    var pagenum = args.pagenum;
    var pagesize = args.pagesize;
    searchpgno = pagenum+1 ;
    ppagesize = pagesize;
    GetSearch();
    });

    json Data format:
    =================

    Object {TotalRows1: 31, Rows1: Array[10], ItemCount: 10 }


    Nadezhda
    Participant

    Hello jishnu2026,

    I have noticed that column { text: AHouse, datafield: 'cHouse', width: '13%' }, is not defined in the source datafields. I also suggest you to take out the , after last datafield in columns.

    Please, provide us a sample data from your ajax call and remember to format it by selecting it and pressing the code button in the toolbar.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/


    jishnu2026
    Participant

    Hi this is my sample ajax data

    {
        "TotalRows1": 31,
        "Rows1": [
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "Seena"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "Mohan"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "RAVI"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "rahul"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "rahul"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "rahul"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "ssf"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "ss"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "abc"
            },
            {
                "Address": "abc",
                "Age": 32,
                "Fullname": "abc"
            }
        ],
        "ItemCount": 10
    }

    Nadezhda
    Participant

    Hi jishnu2026,

    It is not recommended “pagechanged” to call the initialization code (function Get Search()) of the grid. I suggest you to initialize the grid only in the beginning.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.