1. #1
    Ext User ka3S's Avatar
    Join Date
    Jan 2008
    Posts
    35
    Vote Rating
    0
    ka3S is on a distinguished road

      0  

    Exclamation Paging start and limit problem

    Paging start and limit problem


    How can'I change the serverside code to look for the start and limit params which get added to the url automatically on initial rendering?

    In my example, instead of displaing only 10 rows, there is all the rows in all the pages (6 pages in my case) of the grid. I want to kwon what is the problem :

    Code:
    var columnModel;
    var tableModelName;
    var fieldsArray;
    
    Ext.onReady(function() {
    
    fieldsArray = [
        {name : 'utlcod' , mapping : 'utlcod'},
        {name : 'utlnom' , mapping : 'utlnom'},
        {name : 'utldat' , mapping : 'utldat'},
        {name : 'utleml' , mapping : 'utleml'}
                ];
    
        var store = new Ext.data.Store (
        {
            proxy: new Ext.data.HttpProxy (
            {
                url: myUrl
            }
                    ),
            reader: new Ext.data.XmlReader(
            {record: "record" },
                    fieldsArray
                    ),
    		// turn on remote sorting
            remoteSort: true
        });
        store.setDefaultSort('ultcod', 'ASC');
    
        // pluggable renders
        function renderTopic(value, p, record){
            return String.format('<b>{0}</b>{1}', value, record.data['utlcod']);
        }
    
        function renderLast(value, p, r){
            return String.format('{0}<br/>by {1}', value, r.data['utleml']);
        }	
    
        columnModel = new Ext.grid.ColumnModel([
        {
            id: 'utlcod',
            header: 'Code user',
            width: 90,
            dataIndex: 'utlcod',
            renderer: renderTopic
        },    
        {
            header: 'Nom user',
            width:90,
            dataIndex: 'utlnom'
        },
        {
            header: 'Date',
            width: 90,
            sortable: true,
            dataIndex: 'utldat'
        },
        {
            header: 'email user',
            width:90,
            dataIndex: 'utleml',
            renderer: renderLast
        }
                ]);
    
        function getColumnModel() {
            return columnModel;
        }
    
        var grid = new Ext.grid.GridPanel({
            el:'mygrid',
            width:730,
            height:300,
            title:'View Data',
            store: store,
            cm: getColumnModel(),
            trackMouseOver:false,
            loadMask: true,
            enableHdMenu: false,
            bbar: new Ext.PagingToolbar({
                pageSize: 10,
                store: store,
                displayInfo: true,
                displayMsg: 'Displaying rows {0} - {1} of {2}',
                emptyMsg: "No data to display"
            })
        });
    
        grid.render();
        
        grid.getSelectionModel().selectFirstRow();
    
    	// trigger the data store load
        store.load({params:{start:0, limit:10}});
    
    	function toggleDetails(btn, pressed){
            var view = grid.getView();
            view.showPreview = pressed;
            view.refresh();
        }
    });
    What is the problem whith renderTopic() and renderLast()

  2. #2
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    France
    Posts
    223
    Vote Rating
    0
    tof is on a distinguished road

      0  

    Default


    Hi,

    This is the "Examples and Extras" forum section, not the "help" section.
    Anyway,

    Quote Originally Posted by ka3S View Post
    How can'I change the serverside code to look for the start and limit params which get added to the url automatically on initial rendering?

    In my example, instead of displaing only 10 rows, there is all the rows in all the pages (6 pages in my case) of the grid. I want to kwon what is the problem
    Well this is code on the server side, nothing to do with extjs or javascript.
    Just send only the rows asked.
    Even with a paging toolbar, if you send more than pageSize rows, it won't slice them. That's your job to slice it server side.
    But you should also send a "totalCount" property, for the pagingToolbar to know how many pages there are .

    What is the problem whith renderTopic() and renderLast()
    Is this a question ?
    If yes, well, what is the problem you encounter ?

Thread Participants: 1