Results 1 to 6 of 6

Thread: PLEASE URGENT GRID RENDER FUNCTION

  1. #1
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    211

    Default PLEASE URGENT GRID RENDER FUNCTION

    I want to dynamic retrieve column name.

    grid call function :

    {header: 'Discritpion', dataIndex: 'field0', renderer: myfunc } ....


    function:

    function myfunc(value, p , r){

    // retrieve dataindex dynamicly
    }


    thanks for your help
    Vador

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

    Default

    This is a limitation of the renderer function. It doesn't pass a reference to the view, grid and/or columnmodel.

    The only way to make this work is if you have a reference to the view, grid and/or columnmodel in a closure, e.g.
    Code:
    var cm = new Ext.grid.ColumnModel([
      ...
      {header: 'Discritpion', dataIndex: 'field0', renderer: function(value, meta, record, rowIndex, colIndex, store){
        var dataIndex = cm.getDataIndex(colIndex);
        ...
      }},
      ...
    ]);

  3. #3
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    211

    Default

    Many thanks condor
    Vador

  4. #4
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    211

    Default

    thanks
    Vador

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

    Default

    Is just realized that retrieving the dataIndex isn't a problem:
    Code:
    function myfunc(value, p , r){
      var dataIndex = this.name;
      ...
    }

  6. #6
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    211

    Default

    resolved my problem, thanks condor,

    but vadataindex = this.name return a undefined value !

    Why ?

    thanks
    Vador

Posting Permissions

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