简体   繁体   中英

Struts2 jQuery grid plugin

I have an arraylist of type userDetails class. The userDetails class has 3 fields user id,user name and user city

I want to populate arraylist users in a grid using the jQuery plugin.

  <sjg:grid gridModel="users"  caption="Users"
            dataType="json"
            href="%{remoteurl}"
            pager="true"
            rowList="10,15,20"
            rowNum="15"
            rownumbers="true"
            onSelectRowTopics="rowselect"

          >
  <sjg:gridColumn name="userId" index="id" title="ID" formatter="integer" sortable="false"/>
  <sjg:gridColumn name="userName" index="name" title="User Name" sortable="true"/>
  <sjg:gridColumn name="userCity" index="name" title="User City" sortable="true"/>
  </sjg:grid>

This is what I did. But the users are not getting displayed in the grid.

Any suggestions on what the problem is?

Thanks

Try changing gridModel and index attributes like this:

<sjg:grid gridModel="gridModel"  caption="Users"
            dataType="json"
            href="%{remoteurl}"
            pager="true"
            rowList="10,15,20"
            rowNum="15"
            rownumbers="true"
            onSelectRowTopics="rowselect"

          >
     <sjg:gridColumn name="userId" index="userId" title="ID" 
                     formatter="integer" sortable="false"/>
     <sjg:gridColumn name="userName" index="userName" 
                     title="User Name" sortable="true"/>
     <sjg:gridColumn name="userCity" index="userCity" 
                     title="User City" sortable="true"/>
  </sjg:grid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM