Skip to main content
July 2, 2012
Answered

How to alternate color of rows in html cfgrid

  • July 2, 2012
  • 1 reply
  • 1357 views

Hi all

How can I alternate the color of rows in html cfgrid?

I don't have acess to CFIDE/scripts/ajax/resources/ext/css/ext-all.css which is where according to firebug the css styles are kept

Thanks

    This topic has been closed for replies.
    Correct answer itisdesign

    goodychurro1 wrote:

    How can I alternate the color of rows in html cfgrid?

    Hi goodychurro1,

    The cfgrid attribute you are looking for is "striperows".  Optionally, you can also use the attribute "striperowcolor".  Regarding your question in the other thread about binding href/select to a grid, you can use the following cfscript block to create the 'q' query in the example I posted in that other thread (if you're not on CF10).

    <cfscript>

      q = queryNew("myID,myString", "integer,varchar");

      queryAddRow(q, 3);

      querySetCell(q, "myID", 1, 1);

      querySetCell(q, "myID", 2, 2);

      querySetCell(q, "myID", 3, 3);

      querySetCell(q, "myString", "one", 1);

      querySetCell(q, "myString", "two", 2);

      querySetCell(q, "myString", "three", 3);

    </cfscript>

    <cfform>

      <cfgrid name="myGrid" format="html" width="200" query="q" striperows="yes" striperowcolor="##f9f886">

        <cfgridcolumn name="myID" />

        <cfgridcolumn name="myString" />

      </cfgrid>

    </cfform>

    Reference:

    - cfgrid

    Thanks,

    -Aaron

    1 reply

    itisdesign
    itisdesignCorrect answer
    Inspiring
    July 2, 2012

    goodychurro1 wrote:

    How can I alternate the color of rows in html cfgrid?

    Hi goodychurro1,

    The cfgrid attribute you are looking for is "striperows".  Optionally, you can also use the attribute "striperowcolor".  Regarding your question in the other thread about binding href/select to a grid, you can use the following cfscript block to create the 'q' query in the example I posted in that other thread (if you're not on CF10).

    <cfscript>

      q = queryNew("myID,myString", "integer,varchar");

      queryAddRow(q, 3);

      querySetCell(q, "myID", 1, 1);

      querySetCell(q, "myID", 2, 2);

      querySetCell(q, "myID", 3, 3);

      querySetCell(q, "myString", "one", 1);

      querySetCell(q, "myString", "two", 2);

      querySetCell(q, "myString", "three", 3);

    </cfscript>

    <cfform>

      <cfgrid name="myGrid" format="html" width="200" query="q" striperows="yes" striperowcolor="##f9f886">

        <cfgridcolumn name="myID" />

        <cfgridcolumn name="myString" />

      </cfgrid>

    </cfform>

    Reference:

    - cfgrid

    Thanks,

    -Aaron

    July 2, 2012

    Thanks!

    itisdesign
    Inspiring
    July 2, 2012

    goodychurro1 wrote:

    Thanks!

    You're welcome!