So finaly I'm not wrong, my problem is due to a bug with the js fonction 
: javascript:displaytagform

see here for the bug : http://jira.codehaus.org/browse/DISPL-601

Someone know a workaround ? or have solved this problem ?

Thanks


Paslaru Narcis a écrit :
> I usually use a hidden input with the value "paginating".
> And for the other buttons (Search, Cancel, etc.) put a onclick 
> javascript function that changes the value of the hidden to "not 
> Paginating".
>
> Cheers,
> Narcis
>
> On Fri, Nov 13, 2009 at 11:47 AM, Julien Gribonvald 
> <julien.gribonv...@recia.fr <mailto:julien.gribonv...@recia.fr>> wrote:
>
>     Thanks for your response, it was something that I thougth, I have
>     to pass to the form the information that the user is paginating.
>     But i can't find documentation on how to pass attributes to the
>     form when it's for paginating and sorting, or if there are
>     specials attributes which indicates that's the user make a sort or
>     go to next pagnined page.
>
>     Also how can I pass a such information only for paginating and
>     sorting? I mean how to add attributes to the form ? because I
>     tried to make a such thing :
>     form="${namespace}AddAud?navigate=true" at the place of
>     form="${namespace}AddAud", but it doesn't pass the attribute
>     correctly and the form isn't more recognized...
>
>     Thanks
>
>     Julien
>
>
>     Paslaru Narcis a écrit :
>
>         Hi,
>
>         I don't know spring binding, but I think you should try and
>         make a difference between the pagination (the submitting of
>         the form when paginating and sorting) and the submiting using
>         the other buttons (search, cancel) - maybe using a
>         "DispatchAction".
>         One method for search and another one when paginating (making
>         the same seach, with the initial parameters).
>         The form has to be submitted when pagination occurs so it can
>         retrieve the checked checkboxes.
>
>         Cheers,
>         Narcis
>
>         On Fri, Nov 13, 2009 at 10:55 AM, Julien Gribonvald
>         <julien.gribonv...@recia.fr
>         <mailto:julien.gribonv...@recia.fr>
>         <mailto:julien.gribonv...@recia.fr
>         <mailto:julien.gribonv...@recia.fr>>> wrote:
>
>            Hi,
>
>            Nobody can help me ?  I will try a better explaination !
>         (sorry for my
>            english)
>
>            I'm facing to some problems with displaytag lib and with
>            pagination and
>            ordering options of datatable.
>
>            My problem is that i have a search result where the user
>         can select
>            multi results on pagined and sorted pages if he wants, and
>         the problem
>            is when the user make a sort or go on an other page, he
>         loose his
>            selection.
>
>            On the doc of displaytag and with the exemples it says that
>         i need to
>            set the form option in <display:table ... form="...."> to
>         save the
>            selection better sorts and pages. I'm trying to do that, but it
>            doesn't
>            work and it's submiting the form each time that the user make a
>            sort or
>            go to next pagnied page ( I have a validator which return
>         an error
>            about
>            selected values, validator called after submit normaly)...
>         when i
>            remove
>            the form i can navigate on all pagined pages and i can make
>         all sorts,
>            but with the form I stay on the first page and i can't make
>         any sort.
>            Also with the form option the buttons (next, previous,
>         cancel...)
>            doesn't works correctly
>
>            It make some days that I'm trying to solve that but without
>            success, any
>            help would be appreciate.
>
>            Else here is a part of my form :
>
>            [CODE]
>            <spring:nestedPath
>               path="subForm">
>               <portlet:actionURL var="submitAudience">
>                   <portlet:param name="action" value="addAudience" />
>                   <portlet:param name="_page" value="${page}" />
>               </portlet:actionURL>
>               <form name="${namespace}AddAud" method="post"
>                   action="${submitAudience }">
>
>            ....
>            <spring:bind path="subKey">
>            <table border=0 cellpadding=5 width="90%">
>               <tr>
>                   <td><d:table name="${userList}" id="user" sort="list"
>            requestURI="${submitAudience}" form="${namespace}AddAud"
>                           export="false" class="dataTable" defaultsort="2"
>            defaultorder="ascending" cellspacing="1"
>                           pagesize="${nbItemsToShow}"
>             decorator="org.displaytag.decorator.TotalTableDecorator">
>
>                           <d:column title="Select">
>                               <input type="checkbox"
>         name="${status.expression}"
>               value="${user.userId}" />
>                           </d:column>
>
>                           <c:forEach items="${attrDisplay}"
>         var="displayAttr">
>                               <d:column
>         titleKey="news.label.${displayAttr}"
>            sortable="true" headerClass="sortable">
>                                   <c:forEach
>            items="${user.attributes[displayAttr]}"
>                                   var="attrValue">
>                                       <c:out value="${attrValue}" />
>                                   </c:forEach>
>                               </d:column>
>                           </c:forEach>
>
>
>                           <d:setProperty name="paging.banner.item_name"
>                               value="${tit}" />
>                           <d:setProperty name="paging.banner.items_name"
>                               value="${tit}s" />
>
>                       </d:table></td>
>                   </tr>
>                   <tr>
>                       <td><span
>            class="portlet-msg-error">${status.errorMessage}</span></td>
>                   </tr>
>               </table>
>               </spring:bind>[/CODE]
>
>            Subkey is a table of string a property of subForm.
>
>
>            and here is my controller :
>
>            [CODE]
>
>            public class SubcribeController extends
>         AbstractWizardFormController {
>
>              ...
>
>               public SubcribeController() {
>                   setCommandClass(SubForm.class);
>                   setCommandName(Constants.CMD_SUB_F);
>                   setAllowDirtyBack(true);
>                   setAllowDirtyForward(false);
>                   setSessionForm(true);
>                   setPageAttribute(Constants.ATT_PAGE);
>                   setPages(new String[] {Constants.ACT_ADD_AUDIENCE,
>            Constants.ACT_ADD_AUDIENCE, Constants.ACT_ADD_AUDIENCE});
>
>               }
>
>               public void afterPropertiesSet() throws Exception {
>                   ...
>               }
>
>               @Override
>               protected void processFinish(
>                       ActionRequest request, ActionResponse response,
>                       Object command, BindException errors)
>               throws Exception {
>                   SubForm cmd= (SubForm)command;
>                   this.subService.addSubscribers(cmd.getSubKey(),
>            cmd.getSubscriber());
>
>          
>          
> response.setRenderParameter(Constants.ATT_CTX_ID,String.valueOf(cmd.getSubscriber().getCtxId()));
>
>                   response.setRenderParameter(Constants.ACT,
>            Constants.ACT_VIEW_AUDIENCE+cmd.getSubscriber().getCtxType());
>               }
>
>               @Override
>               protected void processCancel(
>                       ActionRequest request, ActionResponse response,
>                       Object command, BindException errors)
>               throws Exception {
>                   SubForm cmd= (SubForm)command;
>                   response.setRenderParameter(Constants.ACT,
>            Constants.ACT_VIEW_AUDIENCE+cmd.getSubscriber().getCtxType());
>
>          
>          
> response.setRenderParameter(Constants.ATT_CTX_ID,String.valueOf(cmd.getSubscriber().getCtxId()));
>
>               }
>
>               @Override
>               protected void validatePage(
>                       Object command, Errors errors, int page, boolean
>         finish) {
>
>                   SubForm subF = (SubForm)command;
>                   SubValidator subValidator = (SubValidator)
>         getValidator();
>                   if (finish) {
>                       this.getValidator().validate(command, errors);
>                       return;
>                   }
>                   switch (page) {
>                   case 0: subValidator.validateSearch(subF, errors);  
>                 break;
>                   case 1:  subValidator.validateSubscriberKey(subF,
>         errors);
>            break;
>                   }
>
>               }
>
>               @Override
>               protected Object formBackingObject(PortletRequest
>         request) throws
>            Exception {
>                   SubForm subForm = new SubForm();
>                   String ctx = request.getParameter(Constants.ATT_CTX);
>                   subForm.getSubscriber().setCtxType(ctx);
>
>          
>          
> subForm.getSubscriber().setCtxId(PortletRequestUtils.getLongParameter(request,
>            Constants.ATT_CTX_ID));
>                   return subForm;
>               }
>
>               @Override
>               protected Map referenceData(PortletRequest request,
>         Object command,
>            Errors errors, int page) throws Exception {
>
>                   boolean isGrp = ((SubForm)
>            command).getSubscriber().getIsGroup()
>            == 1 ? true : false;
>                   Long ctxId = ((SubForm)
>         command).getSubscriber().getCtxId();
>                   String ctx = ((SubForm)
>         command).getSubscriber().getCtxType();
>
>                   if (!this.um.isUserAdminInCtx(ctxId, ctx,
>            request.getRemoteUser())) {
>                       log.warn("SubcribeController:: user " +
>            request.getRemoteUser() + " has no role admin");
>                       throw new PortletSecurityException("you are not
>         authorized
>            for this action");
>                   }
>
>                   Map<String, Object> model = new HashMap<String,
>         Object>();
>                   if (ctx.equalsIgnoreCase(NewsConstants.CTX_C)) {
>                       model.put(Constants.CMD_CATEGORY,
>            this.cm.getCategoryById(ctxId));
>                   } else if (ctx.equalsIgnoreCase(NewsConstants.CTX_T)) {
>                       model.put(Constants.CMD_TOPIC,
>            this.tm.getTopicById(ctxId));
>                       Long cId =
>         this.tm.getTopicById(ctxId).getCategoryId();
>                       model.put(Constants.ATT_CNAME,
>            this.cm.getCategoryById(cId).getName());
>                   }
>                   model.put(Constants.ATT_PM,
>                          
>         RolePerm.valueOf(this.um.getUserRoleInCtx(ctxId, ctx,
>            request.getRemoteUser())).getMask());
>                   if (page == 0) {
>                       model.put("subTypeList",  SubscribeType.values());
>                   } else if (page == 1) {
>                       model.put(Constants.CMD_SUB_F, (SubForm) command);
>                       if (isGrp) {
>                           groups = this.subService.searchGroups(((SubForm)
>            command).getToken());
>                           model.put("grps", groups);
>                       } else {
>                           users = this.um.findPersonsByToken(((SubForm)
>            command).getToken());
>                           model.put(Constants.ATT_USER_LIST, users);
>                       }
>                       model.put(Constants.ATT_LDAP_DISPLAY,
>            um.getLdapUserService().getSearchDisplayedAttributes());
>                       model.put(Constants.ATT_NB_ITEM_TO_SHOW,
>            this.nbItemsToShow);
>                       model.put(Constants.ERRORS, errors);
>                   } else if (page == 2) {
>                       model.put(Constants.CMD_SUB_F, (SubForm) command);
>                       List<EscoUser> lu = null;
>                       if (((SubForm)
>         command).getSubscriber().getIsGroup() ==
>            0) {
>                           lu = new ArrayList<EscoUser>();
>                           for (String id : ((SubForm)
>         command).getSubKey()) {
>                               for (IEscoUser user : users) {
>                                   if
>         (user.getUserId().equalsIgnoreCase(id)) {
>                                       lu.add((EscoUser) user);
>                                   }
>                               }
>                           }
>                       }
>                       model.put(Constants.ATT_USER_LIST, lu);
>                       model.put(Constants.ATT_LDAP_DISPLAY,
>            um.getLdapUserService().getSearchDisplayedAttributes());
>                   }
>                   return model;
>               }
>
>               @Override
>               protected ModelAndView renderInvalidSubmit(RenderRequest
>         request,
>            RenderResponse response)
>               throws Exception {
>                   return null;
>               }
>               @Override
>               protected void handleInvalidSubmit(ActionRequest request,
>            ActionResponse response)
>               throws Exception {
>                   log.warn("SubcribeController:: handleInvalidSubmit:
>         goto home
>            page");
>                   response.setRenderParameter(Constants.ACT,
>            Constants.VIEW_NEWSSTORE);
>
>               }
>
>            ...
>
>               @Override
>               protected boolean isFormSubmission(PortletRequest request) {
>                   for (Enumeration params = request.getParameterNames();
>            params.hasMoreElements();) {
>                       String paramName = (String) params.nextElement ();
>                       if (paramName.startsWith(PARAM_TARGET) ||
>            paramName.equals(PARAM_FINISH) ||
>         paramName.equals(PARAM_FINISH))   {
>                           return true;
>                       }
>                   }
>                   return super.isFormSubmission (request);
>               }
>
>            }
>            [/CODE]
>
>
>            Thanks for all the help you will be able to provide.
>
>
>
>            Julien Gribonvald a écrit :
>            > Hello,
>            >
>            > It makes several hours that after a problem with my
>         multiselect
>            checkbox
>            > in a pagined table.
>            >
>            > My problem is that my checkbox which are selected in one
>         page aren't
>            > kept when i go on a next pagined page, someone have
>         experienced
>            a such
>            > thing or have exemples on how to works with a such case ?
>            > An other problem is that when i go back to the previous
>         pagined
>            page i
>            > can't obtain my next selections.
>            >
>            > So here is my code :
>            >
>            >                     <spring:bind path="subKey">
>            >                                        <d:table
>         name="${userList}"
>            > id="user" sort="list" requestURI="${submitAudience}"
>            >                                                    
>         export="false"
>            > class="dataTable" defaultsort="2" defaultorder="ascending"
>            >
>            > pagesize="${nbItemsToShow}"
>            > decorator="org.displaytag.decorator.TotalTableDecorator">
>            >
>            >                                                     <d:column
>            > title="Select">
>            >                                                        
>         <input
>            > type="checkbox" name="subKey"
>            >
>            > value="${user.userId}" />
>            >                                                    
>         </d:column>
>            >
>            >                                                    
>         <c:forEach
>            > items="${attrDisplay}" var="displayAttr">
>            >                                                        
>         <d:column
>            > titleKey="news.label.${displayAttr}" sortable="true">
>            >                                                          
>              <c:forEach
>            > items="${user.attributes[displayAttr]}"
>            >
>            > var="attrValue">
>            >                                                          
>                  <c:out
>            > value="${attrValue}" />
>            >                                                          
>              </c:forEach>
>            >                                                        
>         </d:column>
>            >                                                    
>         </c:forEach>
>            >
>            >
>            >                                                    
>         <d:setProperty
>            > name="paging.banner.item_name"
>            >                                                          
>          value="${tit}" />
>            >                                                    
>         <d:setProperty
>            > name="paging.banner.items_name"
>            >                                                          
>          value="${tit}s" />
>            >
>            >                                                 </d:table>
>            >                                                
>         </spring:bind>
>            > subKey is a String[] parameter.
>            >
>            > When I submit my selection I have also the current page
>            selection only.
>            >
>            > Thanks for those who can help me for this problem, i
>         tryed many
>            things
>            > but without success.
>            >
>            > Thanks
>            >
>            > - Julien
>            >
>            >
>          
>          
> ------------------------------------------------------------------------------
>            > Let Crystal Reports handle the reporting - Free Crystal
>         Reports
>            2008 30-Day
>            > trial. Simplify your report design, integration and
>         deployment -
>            and focus on
>            > what you do best, core application coding. Discover
>         what's new with
>            > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>            > _______________________________________________
>            > displaytag-user mailing list
>            > displaytag-u...@lists.sourceforge.net
>         <mailto:displaytag-u...@lists.sourceforge.net>
>            <mailto:displaytag-u...@lists.sourceforge.net
>         <mailto:displaytag-u...@lists.sourceforge.net>>
>
>            > https://lists.sourceforge.net/lists/listinfo/displaytag-user
>            >
>            >
>            >
>
>
>          
>          
> ------------------------------------------------------------------------------
>            Let Crystal Reports handle the reporting - Free Crystal Reports
>            2008 30-Day
>            trial. Simplify your report design, integration and
>         deployment -
>            and focus on
>            what you do best, core application coding. Discover what's
>         new with
>            Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>            _______________________________________________
>            displaytag-user mailing list
>            displaytag-u...@lists.sourceforge.net
>         <mailto:displaytag-u...@lists.sourceforge.net>
>            <mailto:displaytag-u...@lists.sourceforge.net
>         <mailto:displaytag-u...@lists.sourceforge.net>>
>
>            https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
>
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to