jQWidgets Forums

jQuery UI Widgets Forums Grid virtualmode problem with totalrecords

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 9 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • virtualmode problem with totalrecords #83706

    omargarro
    Participant

    Hi, I have my grid like this:

    var source = {
    	type: 'post', url: 'inc/getOrders.php', datatype: "json", cache: false, 
    	data: {},
    	datafields: [
    		{ name: 'OrderNbr', type: 'int'},{ name: 'TypeOf', type: 'string'},
    		{ name: 'State', type: 'string'},{ name: 'CustomerName', type: 'string'},
    		{ name: 'Active', type: 'string'}
    	],
    	id: 'OrderNbr',
    	root: 'Rows',
    	beforeprocessing: function(data) { 
    		console.log(data[0].totalrecords);
    		source.totalrecords = data[0].totalrecords;	 
    	}
    }
    
    var dataAdapter = new $.jqx.dataAdapter(source, 
    	{
    		loadComplete: function () {},
    		loadError: function(xhr, status, error) {
    			console.log(xhr.responseText); 
    	}
    });
    		
    $("#grid").jqxGrid( { 
    	source: dataAdapter,
    	theme:'energyblue', 
    	width: 800, height: 500, 
    	columnsresize: true, sortable: true, enabletooltips: true, 
    	pageable: true,  pagesize: 50, virtualmode: false, pagesizeoptions: ['20', '50', '100', '200'], 
    	rendergridrows: function(obj) { 
    		return obj.data; 
    	}, 
    	columns: [
    		{ text: 'Order', datafield: 'OrderNbr', width: 100},
    		{ text: 'Type', datafield: 'TypeOf', width: 200},
    		{ text: 'State', datafield: 'State', width: 200},
    		{ text: 'Customer', datafield: 'CustomerName', width: 200},
    		{ text: 'Active?', datafield: 'Active', width: 50}
    	]
    });
    

    I tested the server side php script and it retrieves 198 records from DB.

    When virtualmode is true, the 198 records are retrieved and the paginator works as expected.
    When virtualmode is false, only the first 50 records are shown. Paginator shows: “1-50 of 50” (only 1 page with 50 records and pressing on ‘next page’ button does nothing)

    Although console.log(data[0].totalrecords) on beforeprocessing always outputs 198

    Thanks in adv
    Omar.

    virtualmode problem with totalrecords #83710

    Peter Stoev
    Keymaster

    Hi omargarro,

    totalrecords as demonstrated in our examples should be set when virtual mode is true. You can review the demos about Server paging.
    totalrecords should not be set when virtual mode is false.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.