Results 1 to 10 of 10

Thread: Gird row and column in renderer function

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default Gird row and column in renderer function

    Hi ,
    I wrote a "Generic" renderer function that is used by several GridPanel.
    How to determine the row and column number from the renderer function.

    Thanks in advance.

  2. #2

  3. #3
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Thanks a Million

  4. #4
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Since i am using this renderer as "generic" to different GridPanels. Is it possible to know which grid panel is calling this renderer function?

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Specify its scope to be the grid:

    http://www.extjs.com/deploy/dev/docs...ember=renderer

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Meh, can't do that, it has to be created before the grid!

    This is an old problem! It needs a fix in Ext!

  7. #7
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Thanks for the reply

  8. #8
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You could update the renderer scope for all columns after the grid is created (but not loaded).

    But I would prefer a default scope, e.g.
    Code:
    Ext.override(Ext.grid.GridView, {
        getColumnData : function(){
            var cs = [], cm = this.cm, colCount = cm.getColumnCount();
            for(var i = 0; i < colCount; i++){
                var name = cm.getDataIndex(i);
                cs[i] = {
                    name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
                    renderer : cm.getRenderer(i),
                    scope: cm.getRendererScope(i) || this,
                    id : cm.getColumnId(i),
                    style : this.getColumnStyle(i)
                };
            }
            return cs;
        }
    });

  9. #9
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    +1000

    Access to the grid is so often required in the renderer!

  10. #10
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Thanks Condor

Posting Permissions

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