anoop
anoop

Reputation: 1614

Insert different classes in alternate rows in struts2 datagrid

i am using datagrids in struts2, i have almost done the integration and now i want to insert different classess in the alternate rows in the listing.

Here is my script

 <sjg:grid
        id="gridtable"
        dataType="json"
        href="%{remoteurl}"
        pager="true"
        gridModel="cityList"        
        rowNum="%{rows}"
        rownumbers="true"  
        altRows ="true"
        altClass = "even"


    >
        <sjg:gridColumn  name="id" index="id" title="ID" formatter="integer" sortable="true"/>
        <sjg:gridColumn name="name" index="name" title="Name" sortable="true"/>
        <sjg:gridColumn name="state_Code" index="state_Code" title="state_Code" sortable="true"/>

    </sjg:grid>

I have set the option

altRows ="true"
altClass = "even"

it generate the class even in all even rows. But i also want to insert odd class in odd rows. How it could be possible?

Upvotes: 0

Views: 505

Answers (1)

Quaternion
Quaternion

Reputation: 10458

Use the underlying jquery datagrid directly found here: http://www.trirand.com/blog/

Figure out how to use the struts2-json-plugin for ajax and you'll be miles ahead.

As a web programmer you must know JS.

That aside... You are aware that you have set "altClass" but you never set "cssClass" that could be an issue? Consult the documentation on this tag library here: http://code.google.com/p/struts2-jquery/wiki/GridTag#Using_Tags_to_render_the_Grid

Upvotes: 3

Related Questions