1. #1
    Sencha User treblereel's Avatar
    Join Date
    Mar 2010
    Location
    Moscow,Russia
    Posts
    67
    Vote Rating
    1
    treblereel is on a distinguished road

      0  

    Default how do i can set styles for several columns via TreeGridCellRenderer

    how do i can set styles for several columns via TreeGridCellRenderer


    Hi all, example below works only for the first column, but i need something like this for the several columns.

    PHP Code:
    name.setRenderer(new TreeGridCellRenderer<ModelData>() {
                
                @
    SuppressWarnings("unchecked")
                public 
    Object render(ModelData modelString propertyColumnData configint rowIndexint colIndexListStore<ModelDatastore,
                          
    Grid<ModelDatagrid) {
                        
                                         if(
    blabla== true){
                        
    config.css "x-treegrid-column-red";
    }else{
    config.css "x-treegrid-column-green";
    }


                        
    assert grid instanceof TreeGrid "TreeGridCellRenderer can only be used in a TreeGrid";

                        @
    SuppressWarnings("rawtypes")
                        
    TreeGrid tree = (TreeGridgrid;
                        @
    SuppressWarnings("rawtypes")
                        
    TreeStore ts tree.getTreeStore();
                        
    int level ts.getDepth(model);
                        
    String id getId(treemodelpropertyrowIndexcolIndex);
                        
    String text getText(treemodelpropertyrowIndexcolIndex);
                        
    AbstractImagePrototype icon calculateIconStyle(treemodelpropertyrowIndexcolIndex);
                        
    Joint j calcualteJoint(treemodelpropertyrowIndexcolIndex);
                        return 
    tree.getTreeView().getTemplate(modelidtexticonfalsejlevel 1);
                      }
                
            }); 

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    868
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    A TreeGrid can only have one TreeGridCellRenderer set... and it is for the first column.

    For the other columns, you must set a normal GridCellRenderer, and then you can style things on it.

    Regards,
    Michel.

  3. #3
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    A TreeGrid can only have one TreeGridCellRenderer set... and it is for the first column.
    You can have it on any column, but you can only have one column with a TreeGridCellRenderer

  4. #4
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    868
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Quote Originally Posted by sven View Post
    You can have it on any column, but you can only have one column with a TreeGridCellRenderer
    You are right... normally we use it for the first column
    But it is not a rule.

Similar Threads

  1. Styles for columns in Grid
    By major in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 10 May 2010, 1:03 AM
  2. Override TreeGridCellRenderer ?
    By gald in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 5 Apr 2010, 12:46 AM
  3. Unable to set style using TreeGridCellRenderer
    By mathaj77 in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 19 Aug 2009, 1:41 AM

Thread Participants: 2