8 Replies Latest reply on Dec 20, 2007 12:48 PM by Sergey Smirnov

    column skinnability with css

    lol kikoo Newbie

      Hello,
      I have a rich:dataTable, and i would like to color some of the colums diferently.
      So I think the way to do this is that one, am I right ?

      <rich:column styleClass="sdt_col" >


      But I can't find what to put in the css...It says it's the same as the dataTable component but I don't understand how It works..

      I just put this on the css file but obviously it doesnt work and I'm a little lost in the skinnability world...

      .sdt_col
      {
       background-color:#FF0000;
      }
      


      Thanks for your help !

        • 1. Re: column skinnability with css
          Florian Marwede Expert

          Please don't mix up things.

          You say, you wanna change style of some columns, not of all. So you shouldn't change the predefined css classes of richfaces components described in the developer guide.

          What you really do, is correct, I think: Defining an own style class (hope you load it...) and apply it to a concrete column. Hmm...that should work.

          Perhaps you have to post some more code so we can find out what's wrong.

          • 2. Re: column skinnability with css
            lol kikoo Newbie

            That's right, I dont want to change de predefined css class of Colum.
            I just wanted to change one param, but I don't think it works that way...
            My idea was to define a classe with styleClass, only on the wanted colums, like this :

            <rich:columnGroup>
             <rich:column>
             <h:outputText value="#{vehb.vehicule.immat}" />
             </rich:column>
             <rich:column styleClass="sdt_col">
             <h:....
            ..
            


            and define this sdt_col class. But I don't know if it's the right thing to do, and what to put in this class..

            • 3. Re: column skinnability with css
              Florian Marwede Expert

              What do you mean: " But I don't know .... what to put in this class.."

              Answer: Valid css code. :-)

              You had not explicitly answer my question: Do you load your own css file?

              Besides I think your way is correct.

              What is the official RF team statement?

              • 4. Re: column skinnability with css
                lol kikoo Newbie

                I didnt load a css file until now, to do that.
                Now i put in the template.xhtml :

                <link rel="stylesheet" href="/style.css" />
                


                and wanted to change the background of the column in this file like that :

                .sdt_col
                {
                background-color:#FF0000;
                }


                But it doesnt work, so I maybe I can't do that, or It's not the right parameter..

                • 5. Re: column skinnability with css
                  lol kikoo Newbie

                  Heh the first quote was disapeared...
                  There was this line (with < >) :

                  link rel="stylesheet" href="/style.css"

                  • 6. Re: column skinnability with css
                    Sergey Smirnov Master

                    Use CODE not a QUOTE for source code.

                    In general, "/style.css" looks very strange. What the URL you use to reach the page?

                    • 7. Re: column skinnability with css
                      lol kikoo Newbie

                      Priviet sergey.
                      yeah sorry for the quote, I dont know why I put these :p

                      You were right...I though I could put /style.css but obviously I cant.
                      So I changed the path to :

                      #{facesContext.externalContext.request.contextPath}


                      I found this in another forum, but I don't understand why this works...
                      This absolute path works for images, so why not css ?

                      • 8. Re: column skinnability with css
                        Sergey Smirnov Master

                        if you have an application with name "myapp" and the style sheet is located at the root of the myapp, the path will be:

                        src="/myapp/style.css"

                        but not just

                        src="/style.css"

                        unless you create an alias for root of the webserver.


                        If you do not want to add this: #{facesContext.externalContext.request.contextPath}

                        use:

                        <a4j:loadStyle src="/style.css" />