1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    geschel is on a distinguished road

      0  

    Question Unanswered: Need help! Background-color in cell without padding!

    Unanswered: Need help! Background-color in cell without padding!


    Hi

    I am trying to set the background color of an individual cell (WITHOUT cellpadding) in a Grid.
    So far the only successfull way was to set it manually with Firebug - and that is difficult to communicate to the customer
    Is there a way in GXT to access the surrounding div of this cell in order to set its style?
    How can i modify this generated css class "GDT2WDTHGC" ?

    thank you in advance
    geschel


    q1.jpg

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    87
    Answers
    2
    Vote Rating
    3
    esag_dk is on a distinguished road

      0  

    Default


    Have you tried adjusting the width and height of the cell's content?
    Anyway, I assume this is a better approach:
    Code:
     getView().setViewConfig(new GridViewConfig<MODEL>()
            {
    
                @Override
                public String getRowStyle(MODEL model, int rowIndex)
                {
                    return CSS_STYLE;
                }
    
                @Override
                public String getColStyle(BankProductOrSegment model,
                        ValueProvider<? super BankProductOrSegment, ?> valueProvider, int rowIndex, int colIndex)
                {
                    return CSS_STYLE;
                }
            });
    This sets a custom style to a row/column depending on contained object and row/col index. This way you can set the desired background color for the entire cell and not only the contained text. But don't forget to return the css style name and not the style itself (so don't return "background-color: xx" but the corresponding style name defined in your css file). And "!important" may be needed to really color the cell (at least I needed it).

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    geschel is on a distinguished road

      0  

    Default


    works fine now with '!important', thanks a lot!

Thread Participants: 1