0 Replies Latest reply on May 9, 2013 4:07 AM by Salvatore Di Franca

    rich:suggestionBox onselect ugent problem

    Salvatore Di Franca Newbie

      Hi to all,

       

      i'm sorry for my bad english but i don't speak english well!

       

      I have a very important urgent problem that i am not to able to resolve.

       

      I have read and follow all the solution described in the other post of the community, but they don't work.

       

      The problem is the following:

       

      I have the following component (a suggestion box) :

       

      <f:subview id="subView#{IdGenerator.dynamicId}">

                  <s:span id="span#{field}"

                          style="overflow:hidden; display:block; float:left; width: #{width};"

                          styleClass="#{invalid?'errors':''}"

                    rendered="#{rendered == null ? true : rendered}">

                          <h:inputText id="input#{field}" value="#{val}" alt="#{val}" title="#{val}"

                                    styleClass="crab-input  crab-mod-div-helper"

                                    style="float:left; width:#{inputWidth}px!important;text-align:left;#{invalid?'border: 1px solid red !important;':'border: 0px none!important; border-right: 1px solid #d0d0d0!important;'}background-color:transparent"

                                    disabled="#{disabled == null ? false : disabled}"

                                    required="#{required}"

                                    onfocus="this.originalvalue=this.value">

       

                                    <a:support event="onchange"

                                              action="#{comboConfManager.checkValueExists(model, fieldToUpdate, val, suggestionList)}"

                                              ajaxSingle="true"

                                              ignoreDupResponses="true"

                                              status="statusGeneral"

                                              reRender="span#{field}, #{reRender}"

                                              oncomplete="Mod.modified(jQuery('[id$=input]'), event, 'div');" />

       

       

                                    <rich:suggestionbox id="#{field}" selfRendered="true"

                                              var="result" width="#{inputWidth + 20}"

                                              suggestionAction="#{model.autocomplete}"

                                              for="input#{field}"

                                              ignoreDupResponses="true"

                                              status="statusGeneral"

                                              ajaxSingle="true"

                                              fetchValue="#{result[indexFetchValue]}">

       

                                              <f:param name="validator" value="#{validatorName}" />

       

                                              <h:column><h:outputText value="#{result[indexFetchValue]}" style="font-style:italic" /></h:column>

                                              <h:column rendered="false">#{result[indexHiddenField]}</h:column>

       

                                              <a:support event="onselect" status="statusGeneral"

                                                                  action="#{comboConfManager.updateField(model,fieldToUpdate,result)}"

                                                                  ajaxSingle="true"

                                                                  oncomplete="Mod.modified(jQuery('[id$=input#{field}]'), event, 'div');"  ignoreDupResponses="true"

                                                                  reRender="#{reRender}">

       

                                              <f:setPropertyActionListener value="#{result}" target="#{comboConfManager.selectedValue}"/>

       

                                              <c:if test="#{withDecode==true}">

                                                         <f:setPropertyActionListener value="#{result}" target="#{decodeValue}" />

                                              </c:if>

       

                                              </a:support>

       

                                    </rich:suggestionbox>

                          </h:inputText>

       

                          <s:span rendered="#{disabled == null ? true : !disabled}">

                                    <a href="#" class="crab-combo"

                                                        onclick="#{rich:component(field)}.callSuggestion(true);"></a>

                          </s:span>

                          <s:span rendered="#{disabled == null ? false : disabled}">

                                    <a href="#" class="crab-combo crab-combo-disabled"></a>

                          </s:span>

                  </s:span>

        </f:subview>

       

       

      My mylib.taglib.xml content is:

       

      <tag>

                <tag-name>comboConf</tag-name>

                <source>comboConf.xhtml</source>

      </tag>

       

      This component is in a column of an rich:extendedDataTable like this:

       

      <rich:extendedDataTable id="lstVr"

                                                                  sortMode="single"

                                                                  enableContextMenu="false"

                                                                  rowKeyVar="index"

                                                                  value="#{conversationScope.get('riservatezzaViewList').searchResult}" var="riga"

                                                                  cellpadding="0"

                                                                  cellspacing="0"

                                                                  headerClass="crab-grid-header"

                                                                  eventsQueue="codaFiltrilstVr"

                                                                  noDataLabel="#{messages['SearchResultEmpty']}"

                                                                  columnClasses="padding-left-five noPadding"

                                                                  selectedClass="crab-row-selected colsNoSelect"

                                                                  ajaxKeys="#{conversationScope.get('riservatezzaViewList').rowsToUpdate}"

                                                                  height="#{gridSizeBean.bigExtendedDataTableHeightPx}">

       

      <rich:column id="nomeEnt" width="36%" filterEvent="onkeyup"

                                                                            styleClass="#{riga.isDeleted() ? 'background-red' : null }"

                                                                            filterExpression="#{filterUtil.matchFilter(filterUtil.fltValNomeEntVR,riga.nomeEnt)}"

                                                                            sortBy="#{riga.nomeEnt}" selfSorted="false"

                                                                            sortOrder="#{orderUtil.nomeEntVRDirection}">

                                                                            <f:facet name="header">

                                                                                      <dm:filterHeader filterValue="#{filterUtil.fltValNomeEntVR}"

                                                                                                fldName="NEVR" idTbl="lstVr" />

                                                                            </f:facet>

                                                                            <h:outputText value="#{riga.nomeEnt}" rendered="#{not conversationScope.get('riservatezzaViewList').isEditable() or riga.isAttached() or riga.isDeleted()}" />

       

                                                                            <s:decorate id="nomeEntField" template="/layout/editInline.xhtml"

                                                                                       rendered="#{conversationScope.get('riservatezzaViewList').isEditable() and not riga.isDeleted() and not riga.isAttached()}" >

       

                                                                                                          <dm:comboConf model="#{riga}"

                                                                                                                    val="#{riga.nomeEnt}"

                                                                                                                    controller="#{conversationScope.get('riservatezzaViewList')}"

                                                                                                                    field="nomeEntita"

                                                                                                                    validatorName="nomeViewEnt"

                                                                                                                    fieldToUpdate="nomeEnt"

                                                                                                                    nameForm="listForm"

                                                                                                                    fieldDecorate="nomeEntField"

                                                                                                                    required="true"

                                                                                                                    suggestionList="#{xEntityUtil.getEntByCodAppl(null,null)}"

                                                                                                                    inputWidth="280"

                                                                                                                    width="90%"

                                                                                                                    indexRow="#{index}"

                                                                                                                    indexHiddenField="1"

                                                                                                                    indexFetchValue="0"

                                                                                                                    reRender="codiceAppl"

                                                                                                                    withDecode="true"

                                                                                                                    decodeValue="#{conversationScope.get('riservatezzaViewList').test}"/>

       

        </s:decorate>

       

                                                                  </rich:column>

       

       

      THE PROBLEM IS THIS:

       

      when i select an element from suggestion box , the action method written in the onselect support (  action="#{comboConfManager.updateField(model,fieldToUpdate,result)}"  ) has been executed but the value of "result" is always null!!!

       

      PS. The     <f:setPropertyActionListener value="#{result}" target="#{comboConfManager.selectedValue}"/> doesn't work because when i select an item the property selectedValue of bean comboConfManager has been set to null!!

       

      Note that the scope of seam component "comboConfManager" is conversation!

       

      PLEASE HELP ME!

      THANKS!!