Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Colouring cell using ListGrid BaseStyle

    Hi,

    We are using SmartGWT Pro 3.0 version.

    We have a grid in which a field is editable (SelectItem) having 1,2 and 3 as values.

    we have to display different colors for each of them using getBaseStyle()

    I have given the code below:


    final ListGrid alertGrid = new ListGrid()
    {
    @Override
    protected String getBaseStyle(ListGridRecord record, int rowNum,int colNum)
    {
    if(getFieldName(colNum).equals(Constant.Status))
    {
    int status = record.getAttributeAsInt(Constant.Status);
    if(status ==1)
    {
    return "myHighGridCell";
    }
    else
    {
    return super.getBaseStyle(record, rowNum, colNum);
    }
    }
    else
    {
    return super.getBaseStyle(record, rowNum, colNum);
    }
    }
    };


    The Problem is it is displaying the content of the cell in some font style but there is no any color. how can we display the colors.

    what to do for this?

    Thanks in Advance

    #2
    Hi,

    I got it, we have to define a css class. Fine!!!

    Then i need to color entire records depending on one single cell in that record. how can i do this?

    Second, The even number of rows are not accepting the BaseStyle default it looks some grayed out. how can i make this to be in BaseStyle.

    Thanks,

    Comment


      #3
      See alternateRecordStyles - if enabled, every other row appends "Dark" to the baseStyle.

      As far as having all cells in a row have the same baseStyle, getBaseStyle() is called once per cell, so you can apply whatever logic you want.

      Comment


        #4
        Yes. Thanks

        Comment

        Working...
        X