Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Ext.ux.grid.PagingRowNumberer

  1. #11
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    Quote Originally Posted by [email protected] View Post
    Stupid question. Couldn't all of the page numbers be done on the server side? We all pass a start && limit to the server. It could easily do the math and append 'row number' to the returning dataset.

    Thoughts?
    that's what i was doing in 1.1

    still doesn't solve the column width issue though...
    perhaps that too could be passed back from the server in a metaData config stored in the JSON response.

  2. #12
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    I ask because that's what i'm doing now. I do what ever I can do on the server is to reduce overhead on the browsers.

  3. #13

    Default

    This is something I want

    But, I do not know how to add this to my codes

    Can anyone give me some pointers on how can I add this to my existing code?

    Here's my code:
    Code:
    var countryColumnModel = new Ext.grid.ColumnModel([
    	        // This is a utility class that can be passed into a Ext.grid.ColumnModel 
    	        // as a column config that provides an automatic row numbering column.
    	        //new Ext.ux.grid.PagingRowNumberer(v, p, record, rowIndex, colIndex, store),
    	        new Ext.grid.RowNumberer(),
    	        {
    	            header: "Country", 
    	            width: 100, 
    	            sortable: true,
    	            dataIndex: 'description'
    	        },{
    	            header: "Code", 
    	            width: 100, 
    	            sortable: true,
    	            dataIndex: 'code'
    	        },{
    	            header: "Region", 
    	            width: 100,
    	            sortable: true, 
    	            dataIndex: 'region'
    	        }
    	    ]);

  4. #14
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    1. create an ext-overrides.js file, and include it immediately after ext-all.js
    2. dump the code in post #1 into this overrides file
    3. replace the RowNumberer in your code with Ext.ux.grid.PagingRowNumberer. i.e.
      Code:
      var countryColumnModel = new Ext.grid.ColumnModel([
          // This is a utility class that can be passed into a Ext.grid.ColumnModel 
          // as a column config that provides an automatic row numbering column.
          //new Ext.ux.grid.PagingRowNumberer(v, p, record, rowIndex, colIndex, store),
          new Ext.ux.grid.PagingRowNumberer(),
      
      
          // other configs here...
      ]);



    voila.

  5. #15

    Default

    Quote Originally Posted by mystix View Post
    1. create an ext-overrides.js file, and include it immediately after ext-all.js
    2. dump the code in post #1 into this overrides file
    3. replace the RowNumberer in your code with Ext.ux.grid.PagingRowNumberer. i.e.
      Code:
      var countryColumnModel = new Ext.grid.ColumnModel([
          // This is a utility class that can be passed into a Ext.grid.ColumnModel 
          // as a column config that provides an automatic row numbering column.
          //new Ext.ux.grid.PagingRowNumberer(v, p, record, rowIndex, colIndex, store),
          new Ext.ux.grid.PagingRowNumberer(),
      
      
          // other configs here...
      ]);



    voila.
    Thnx for the quick response, mystix

    I did exactly what you've posted and I got this
    Ext.ux.grid has no properties
    [Break on this error] renderer : function(v, p, record, rowIndex, colIndex, store){
    in my firebug

  6. #16
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    you need to setup the Ext.ux.grid namespace:
    Code:
    Ext.namespace('Ext.ux.grid'); // create Ext.ux.grid namespace
    
    // custom RowNumberer for use with paging GridPanels
    Ext.ux.grid.PagingRowNumberer = Ext.extend(Ext.grid.RowNumberer, {
      renderer : function(v, p, record, rowIndex, colIndex, store){
        if (this.rowspan) {
          p.cellAttr = 'rowspan="' + this.rowspan + '"';
        }
    
        var so = store.lastOptions;
        var sop = so? so.params : null;
        return ((sop && sop.start)? sop.start : 0) + rowIndex + 1;
      }
    });
    [edit]
    i've updated the first post to reflect this.
    Last edited by mystix; 8 Jan 2009 at 7:18 PM. Reason: edit

  7. #17

    Default

    Quote Originally Posted by mystix View Post
    you need to setup the Ext.ux.grid namespace:
    Code:
    Ext.namespace('Ext.ux.grid'); // create Ext.ux.grid namespace
    
    // custom RowNumberer for use with paging GridPanels
    Ext.ux.grid.PagingRowNumberer = Ext.extend(Ext.grid.RowNumberer, {
      renderer : function(v, p, record, rowIndex, colIndex, store){
        if (this.rowspan) {
          p.cellAttr = 'rowspan="' + this.rowspan + '"';
        }
    
        var so = store.lastOptions;
        var sop = so? so.params : null;
        return ((sop && sop.start)? sop.start : 0) + rowIndex + 1;
      }
    });
    [edit]
    i've updated the first post to reflect this.
    oh sorry, my bad... I'm new to extending

    PS: it works! wonderful Thnx, mystix

  8. #18
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Just FYI if this is brought up to 3.x see this thread as well:
    http://extjs.com/forum/showthread.php?t=70409

    Should be very easy to update the linked thread for paging support via configuration.

  9. #19
    Sencha User ryanyoungsma's Avatar
    Join Date
    Oct 2008
    Location
    Indialantic, FL
    Posts
    66

    Default How do I get the Row Number without a Selection?

    I have not seen a way to get the row number with the row being selected. I am trying to update the database with the row number so I can keep the order. I originally just posted the entire dataset and updated the order on the server side, but now I am seeing where the dataset is to large and really impacting the performance. So I am implementing the RowNumber with Paging.

    Now I only save the modified records, but I need to send the row number as well?

    PHP Code:
    var records this.store.getModifiedRecords();
        
            if(!
    records.length) {
                return;
            }
            var 
    data = [];

            var 
    this.getBottomToolbar().getPageData().activePage;
            var 
    page 0;
            if(
    != 1){
                
    1;
                
    page 200;    
            }
            
            
    Ext.each(records, function(ri) {
                var 
    r.getChanges();
                
    o.row_index = (row page);
                if(
    r.data.newRecord) {
                    
    o.newRecord true;
                }
                
    o[this.idName] = r.get(this.idName);
                
    data.push(o);
            }, 
    this); 
    I have tried a couple of different options, but they all seem to use the selection model. But my items are not selected. Thoughts?
    _____________________________________________
    Ryan Youngsma

  10. #20
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    327

    Default

    thank u so much, I really appreciated a lot.. This is what I've been looking..

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •