Forum


11:13

09/11/2010

Hi,
I am using struts2-jquery-grid-plugin-2.3.1.jar, grid pager no working in IE but it is working in mozilla-firefox.
Bellow is th code:
java class file:
/**
*
*/
package com.mps.ejp.admin.struts2.actions;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import com.google.inject.Inject;
import com.mps.ejp.admin.delegate.GroupService;
import com.mps.ejp.commons.model.Group;
import com.mps.ejp.commons.model.Journal;
import com.mps.ejp.commons.struts2.actions.Struts2AbstractAction;
import com.opensymphony.xwork2.ModelDriven;
/**
* @author s.lal
*
*/
@ParentPackage("ejp")
@Namespace("/ejp")
public class GroupsAction extends Struts2AbstractAction implements ModelDriven<Group> {
private static final long serialVersionUID = 1L;
@Inject private GroupService groupService;
private Group groupObj;
private String selectedJournalIds = "";
private List<Group> groupList = new ArrayList<Group>();
private List<Journal> jrlnAssignedList = new ArrayList<Journal>();
private List<Journal> jrlnUnassignedList = new ArrayList<Journal>();
private List<Group> gridModel = new ArrayList<Group>();
private Integer rows = 0;
private Integer page = 0;
private Integer total = 0;
private Integer records = 0;
private String sord;
private String sidx;
private int to;
private int from;
private boolean loadonce = false;
public int getTo() {
return to;
}
public void setTo(int to) {
this.to = to;
}
public int getFrom() {
return from;
}
public void setFrom(int from) {
this.from = from;
}
public String getSelectedJournalIds() {
return selectedJournalIds;
}
public void setSelectedJournalIds(String selectedJournalIds) {
this.selectedJournalIds = selectedJournalIds;
}
public List<Journal> getJrlnAssignedList() {
return jrlnAssignedList;
}
public void setJrlnAssignedList(List<Journal> jrlnAssignedList) {
this.jrlnAssignedList = jrlnAssignedList;
}
public List<Journal> getJrlnUnassignedList() {
return jrlnUnassignedList;
}
public void setJrlnUnassignedList(List<Journal> jrlnUnassignedList) {
this.jrlnUnassignedList = jrlnUnassignedList;
}
public List<Group> getGridModel() {
return gridModel;
}
public void setGridModel(List<Group> gridModel) {
this.gridModel = gridModel;
}
public boolean isLoadonce() {
return loadonce;
}
public void setLoadonce(boolean loadonce) {
this.loadonce = loadonce;
}
public Integer getRows() {
return rows;
}
public void setRows(Integer rows) {
this.rows = rows;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public Integer getRecords() {
return records;
}
public void setRecords(Integer records) {
this.records = records;
}
public String getSord() {
return sord;
}
public void setSord(String sord) {
this.sord = sord;
}
public String getSidx() {
return sidx;
}
public void setSidx(String sidx) {
this.sidx = sidx;
}
public Group getModel() {
groupObj = new Group();
return groupObj;
}
@Action(value="manageGroupsAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization") ,
@InterceptorRef("breadcrumb")
},
results={@Result(name="success",type="dispatcher",location="/resources/jsp/admin/manageGroups.jsp"),
@Result(name="failure",type="dispatcher",location="/resources/jsp/common/globalerror.jsp")})
public String manageGroupsAction() throws Exception {
return SUCCESS;
}
@Action(value="getGridAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization") ,
@InterceptorRef("breadcrumb")
},
results={@Result(name="success",type="dispatcher",location="/resources/jsp/admin/groupGrid.jsp"),
@Result(name="failure",type="dispatcher",location="/resources/jsp/common/globalerror.jsp")})
public String getGridAction() throws Exception {
return SUCCESS;
}
@Action(value="getGroupGridAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization")
},
results={@Result(name="success",type="json")})
public String getGroupGridAction() {
try {
groupList = groupService.getAllGroup();
} catch (Exception e) {
e.printStackTrace();
}
if (getSord() != null && getSord().equalsIgnoreCase("asc")){
//Collections.sort(journalSet);
}
if (getSord() != null && getSord().equalsIgnoreCase("desc")){
//Collections.sort(journalSet);
// Collections.reverse(journalSet);
}
setRecords(groupList.size());
to = (getRows() * getPage());
from = to - getRows();
if (to > getRecords()) to = getRecords();
setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
if (loadonce){
setGridModel(groupList);
}else{
setGridModel(groupList.subList(from, to));
}
return SUCCESS;
}
@Action(value="addUpdateGroupAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization")
},
results={@Result(name="success",type="dispatcher",location="/resources/jsp/common/actionResult.jsp")})
public String addUpdateGroup() throws Exception {
int addUpdate[] = groupService.addUpdateGroup(groupObj);
int i = addUpdate[0];
String str = "";
if(i == 1){
str = "Group saved successfully";
}else if(i == 2){
str = "Group updated successfully";
}else{
str = "Duplicate Group Name not Allowed";
}
addActionMessage(str);
return SUCCESS;
}
@Action(value="getGroupJournalTabAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization")
},
results={@Result(name="success",type="json")})
public String getGroupJournalTabAction(){
try {
jrlnAssignedList = groupService.getJournalsAssignedToGroups(groupObj.getGroupId());
jrlnUnassignedList = groupService.getJournalsUnassignedToGroups(groupObj.getGroupId());
} catch (SQLException e) {
e.printStackTrace();
}
return SUCCESS;
}
public String getJSON(){
return getGroupJournalTabAction();
}
@Action(value="updateGrpJrnlAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization")
},
results={@Result(name="success",type="dispatcher",location="/resources/jsp/common/actionResult.jsp")})
public String updateGrpJrnlAction() throws Exception {
int status = groupService.assignJournalsToGroup(groupObj.getGroupId(),selectedJournalIds);
if(status == 1){
addActionMessage("Group updated successfully.");
}else{
addActionMessage("Problem occur at server level.Please try again...");
}
return SUCCESS;
}
@Action(value="deleteGroupAction",interceptorRefs= {
@InterceptorRef("defaultStack"),
@InterceptorRef("authentication"),
@InterceptorRef("authorization")
},
results={@Result(name="success",type="dispatcher",location="/resources/jsp/common/actionResult.jsp"),
@Result(name="error",type="dispatcher",location="/resources/jsp/common/globalerror.jsp")})
public String deleteGroupAction(){
try {
addActionMessage(groupService.deleteGroup(groupObj.getGroupId()));
} catch (SQLException e) {
e.printStackTrace();
return "error";
}
return SUCCESS;
}
}
jsp page:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
<s:url id="groupGridUrl" action="getGroupGridAction">
<s:param name="loadonce" value="%{true}" />
</s:url>
<sjg:grid
width="942"
id="groupGridTable"
dataType="json"
href="%{groupGridUrl}"
pager="true"
navigator="true"
navigatorEdit="false"
navigatorView="false"
navigatorAdd="false"
navigatorDelete="false"
navigatorSearch="false"
rowList="10,20,30,100"
rowNum="10"
gridModel="gridModel"
rownumbers="true"
editinline="false"
viewrecords="true"
altRows="true"
loadonce="true"
altRows="true"
cssClass="grdrow_1"
altClass="grdrow_2"
>
<sjg:gridColumn name="groupId" index="groupId" title="group ID" hidden="true" formatter="integer" editable="false" sortable="false" key="true"/>
<sjg:gridColumn name="groupName" index="groupName" title="Group Name" sortable="true"/>
<sjg:gridColumn name="editBtn" align="center" formatter="formatEditLink" index="editBtn" title="Edit" sortable="false" width="24"/>
<sjg:gridColumn name="deleteBtn" align="center" formatter="formatDeleteLink" index="deleteBtn" title="Delete" sortable="false" width="24"/>
</sjg:grid>
Most Users Ever Online: 715
Currently Online:
65 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66