Themes

Categories

Archives

Meta

GridView css Row/Cell

Posted January 7th, 2009 by
Categories: straightguysca.com
  • Hi,

    I've a grid with a GridView which work successfull I'm using the Grid Faq's example :
    7. How to modify appearance, behavior of specific rows or columns?

    // GridView
    var gridViewParamGestionCouleur = new Ext.grid.GridView({
    getRowClass : function (row, index, cols) {
    var cls = '';
    var data = row.data;
    switch (data.VALEUR_PARAM_GESTION_COULEUR){
    case '#FFFF00' :
    cls = 'yellow-row'
    break;
    }//end switch
    return cls;
    }
    }); //end gridView

    This code detect a color in the colum VALEUR_PARAM_GESTION_COULEUR and apply color to the row.
    It's works fine but I would like to color only the cell which contain the value.
    Have you any idea ???


  • I post my solution if someone will be interest :

    My grid column model :

    var cmParamGestionCouleur = new Ext.grid.ColumnModel([
    {
    id:'VALEUR_PARAM_GESTION_COULEUR',
    header: "Valeur",
    dataIndex: 'VALEUR_PARAM_GESTION_COULEUR',
    renderer: renderMotif, // This line is important
    editor: new Ext.form.ColorField({
    allowBlank: false
    })
    }
    ]


    function renderMotif(data, cell, record, rowIndex, columnIndex, store){
    var value=record.get('VALEUR_PARAM_GESTION_COULEUR')
    //cell.css = "UnStyleCss"; //défini dans style.css
    cell.attr = "style=background-color:"+value; //Color's set here
    return data; //data = text
    }


    http://img186.imageshack.us/img186/6199/couleurmn9.th.png (http://img186.imageshack.us/my.php?image=couleurmn9.png)







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about GridView css Row/Cell , Please add it free.