| Author |
maintin checkbox stauts during paginatin(dispalytag)
|
siddiq syed
Greenhorn
Joined: Aug 14, 2008
Posts: 6
|
|
Hi, I am using a display tag for pagination in my JSP page. I have a checkbox field as one of the columns. I am using displayTagWrapper class to display my checkboxes. I have a submit button in a page which will save checkbox status into the database. I also have pagination and sorting in the page. The problem i have is, i will loose the status of the checkbox when i go to second page. If i select some of the checkboxes in page 1 and go to page 2 to select some more and if i come back, i loose all the selected checkboxes in page 1. Is there a way where i could save my check boxes in session and its checked while i browse across pages and gets submitted all at once. Any help is appreciated Thanks
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Hi... Use like this. <display:column headerClass="Table-Head" title="Status"> <input type="checkbox" id="status" name="userMap[<%=((User) row).getId()%>].active" value="true" <%=((User) row).getActive() == true ? "checked" : ""%>> <input type="hidden" name="userMap[<%=((User) row).getId()%>].id" value="<%=((User) row).getId()%>"> </display:column> Thanks, Nishan Patel.
|
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
|
 |
siddiq syed
Greenhorn
Joined: Aug 14, 2008
Posts: 6
|
|
Hi Nishan, Thanks for your reply. Below is my Jsp code that display a list of check box, This is how i am display the contents of a list , in a table. <display:table name="sessionScope.caseSummaryComposites" style="width:100%" defaultsort="2" requestURI="CONSWEB/task/viewUnallocatedTasks.action" class="display" uid="row" pagesize="5" sort="page"> <display:column> <s:checkbox name="selectedTaskIds" theme="simple" fieldValue="%{#attr.row.task.taskId}" value="false"></s:checkbox> </display:column> <display:column title="Task Priority" property="task.taskPriority.code" sortable="true"/> <display:column title="Task Name" property="task.taskType.name" sortable="true"/> <display:column title="Report Reason" property="caseSummary.reportReasonType.name" sortable="true"/> <display:column title="Case Type" property="caseSummary.considType.name" sortable="true"/> <display:column title="Case Received Date" property="caseSummary.caseReceivedDate" sortable="true"/> <display:column title="Task Creation Date" property="task.taskCreationDate" sortable="true"/> <display:column title="Sentence Prefix" property="caseSummary.sentencePrefixType.code" sortable="true"/> <display:column title="Unique Case Identifer" sortable="true"> <s:url id="caseUrlId" namespace="/team" action="viewCaseDetailAction" encode="true"> <s aram name="caseNumber" value="%{#attr.row.caseSummary.caseId}"/> </s:url> <a href="<s roperty value="%{#attr.caseUrlId}"/>" target="_blank"><s roperty value="%{#attr.row.caseSummary.caseNumber}"/></a> </display:column> <display:column title="Task Status" property="task.taskStatusType.taskStatusTypeName" sortable="true"/> <display:column title="Task Origin" property="task.taskOriginType.name" sortable="true"/> </display:table> As per your sample , i understand that you are using a hidden field that keep track of selected Id's. Can you kindly tell me as per my secnario what will be the value of the hidden filed in order to keep track of selected Id's for multiple page. Regards siddiq.
|
 |
 |
|
|
subject: maintin checkbox stauts during paginatin(dispalytag)
|
|
|