[CLOSED] how can I set the background color of the row in gridpanel ?

  1. #1

    [CLOSED] how can I set the background color of the row in gridpanel ?

    I have a grid panel , and I want to set the background color of the row by adding this in the gridpanel:
    <View>
                        <ext:GridView ID="GridView1" runat="server" TrackOver="True" StripeRows="True">
                            <GetRowClass Fn="getRowClass" />                       
                        </ext:GridView>
                    </View>
    function getRowClass(record, rowIndex, rowParams, store) {
                return "red-grid-row";
            }
    <Style type="text/css">
                .red-grid-row{
                    background: blue;
                }
            </Style>
    but when I browser the gridpanel I find the css: 'red-grid-row' has been added to the tag <tr>, it likes :
    <tr class="x-grid-row red-grid-row ">
    but this doesn't work , the background color of the row is still white, because the css:red-grid-row is covered by the css of cell:
    .x-grid-row .x-grid-cell {
    color: null;
    font: normal 11px/15px tahoma,arial,verdana,sans-serif;
    background-color: white;
    border-color: #ededed;
    border-style: solid;
    border-top-color: #fafafa;
    border-width: 0;
    }
    so can you tell how can i define the background color of the row in gridpanel?
    Last edited by Daniil; Mar 11, 2014 at 6:41 AM. Reason: [CLOSED]
  2. #2
    Hello
    I think you just need to modify your CSS rule so it has right importance ( I think it's called specificity), like
    <Style type="text/css">
                .red-grid-row .x-grid-cell {
                    background: blue !important;
                }
            </Style>
    or
    <Style type="text/css">
                tr.red-grid-row .x-grid-cell {
                    background: blue;
                }
            </Style>
  3. #3
    Hi everybody,

    One additional comment here. I would recommend not to use "!important" if possible. It is a bad practice.
    http://stackoverflow.com/questions/3...portant-in-css

    The absolute majority of CSS overrides are possible without that.

Similar Threads

  1. Change GridPanel Cell background color
    By mis@adphk.com in forum 2.x Help
    Replies: 1
    Last Post: Mar 19, 2013, 1:43 AM
  2. [CLOSED] Gridpanel cell background color
    By mis@adphk.com in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 13, 2013, 2:00 AM
  3. Replies: 3
    Last Post: Feb 14, 2013, 10:35 AM
  4. [CLOSED] GridPanel Row's background-color
    By canbay in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 12, 2013, 12:02 AM
  5. [CLOSED] [1.0] gridpanel set row's background-color
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 10, 2010, 12:37 PM

Posting Permissions