jQWidgets Forums

jQuery UI Widgets Forums Grid jqxGrid in edit mode and virtual paging

This topic contains 5 replies, has 2 voices, and was last updated by  scamiros 11 years ago.

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

  • scamiros
    Participant

    Hi,
    I have a problem with jqxGrid in edit mode with virtual paging option that retrieve data from a server.
    If I set pagesize greater than totalrecords retrieved from the server, when I press F2 on the first row to edit it and then press Tab to navigate in the other columns of the same row, jqxgrid add a number of empty rows that is “pagezise – totalrecords“.
    Any ideas?
    Thanks.


    scamiros
    Participant

    This my code:

    var source =
    		{
    		    datatype: "json",
    		    datafields: [
    				{ name: 'idFesta', type: 'number'},
    		        { name: 'dataFesta', type: 'date', format: "dd/MM/yyyy"},
    		        { name: 'descrizione', type: 'string'}
    		    ], 
    		  url: "${pageContext.request.contextPath}/pr/festivita-page.json",
    		  root: 'content',
    		  cache: false,
    		  beforeprocessing: function (data) {
                            source.totalrecords = data.page.totalElements;
              },
    	         pagesize: 15
    		};
    		
    		 var dataAdapter = new $.jqx.dataAdapter(source);
    
    $("#jqxgrid").jqxGrid(
    		{
    	            editable: true,
                        altrows: true,
                        selectionmode: 'multiplerowsextended',
    		    theme: theme,
    		    source: dataAdapter,
    		    width: '100%',
    		    pageable: true,
    		    pagermode: 'simple',
    		    virtualmode: true,
    		    pagerrenderer: pagerrenderer,
                        rendergridrows: function (params) {
                        return params.data;
               },
    		   columns: [
    		        { text: 'Data', columntype: 'datetimeinput', datafield: 'dataFesta', filtertype: 'date', cellclassname: cellclass, cellsformat: "dd/MM/yyyy"},
    		        { text: 'Descrizione', columntype: 'textbox', filtertype: 'textbox', cellclassname: cellclass, datafield: 'descrizione'}
    		    ]
    		});

    As you can see I set pagesize = 15, the retrieved data are 10 records, so when I try to edit the first row, when I click Tab I see 5 new empty rows on the top of the grid.
    What I wrong?
    Thanks in advance.


    Peter Stoev
    Keymaster

    Hi scamiros,

    To learn how to implement this, see: http://www.jqwidgets.com/jquery-widgets-demo/demos/php/serverpaging.htm?arctic. Note that the “pagesize” defines the size of the page and the Grid will display Pages with that Size. Also in your server requests the pagesize would be 15 so you must ensure in your server code that you implement the paging correctly and not hardcode values.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    scamiros
    Participant

    Thank Peter for reply,
    So if I set pagesize = 15, as I have done in my code, and the server has only 10 records, what happen?


    Peter Stoev
    Keymaster

    Hi scamiros,

    The Grid will display 10 rows with data and 5 empty rows in case the totalrecords is set to 15, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    scamiros
    Participant

    Thanks,
    I discovered the problem, this is the scenario:
    If I set a grid in edit mode that retrieve data from a server in which I set a column as default sortcolumn for order,
    when I edit that column, the grid display empty rows and all data disappear.
    The above code has this issue.
    Help!!

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

You must be logged in to reply to this topic.