3 Replies Latest reply on Apr 4, 2010 5:05 AM by m.a.g

    Problem with rich:calendar internet explorer7

    garriweb

      Hi,

       

        I'm experiencing problems trying to use the selected value from rich:calendar as the filter for a table. Here is how I used the 'filterValueInput' facet from extendedDataTable:

       

      <rich:column id="columnaCalendario" width="15%" sortable="false" label="#{textos['common.table.primera.emision']}"

      style="#{bzaRecord.conciliado  ? 'background-color: 66CDAA;' : ''}"
                      filterBy="#{bzaRecord.primeraEmision}" filterEvent="onchanged">  

                  
                      <f:facet name="header"><h:outputText value="#{textos['common.table.primera.emision']}" /></f:facet>


                      <f:facet name="filterValueInput">
                          <rich:calendar id="calendario" jointPoint="bottom-left" direction="bottom-left" datePattern="dd-MM-yyyy" />
                      </f:facet>


                      <h:outputText value="#{bzaRecord.primeraEmision}"><f:convertDateTime pattern="E dd-MM-yyyy" locale="es"/></h:outputText>
      </rich:column>

       

      The filter works correctly but RichFaces generates the following a javascript error that soen't work in IE7:

       

       

      A4J.AJAX.Submit('bzaMasterForm',event,{'oncomplete':function(request,event,data){var element = request.form.elements['bzaMasterForm:bzaMasterTable:calendario'];if (!element) {element = document.getElementById('bzaMasterForm:bzaMasterTable:calendario')}if (element) {element.focus();element.value = element.value;}},'similarityGroupingId':'bzaMasterForm:bzaMasterTable','parameters':{'bzaMasterForm:bzaMasterTable':'fsp'} } )}} , {}).load();

       

      IE7 complains the element cannot get focus.

       

      Is it a bug?. Any workarounds?

       

      Cheers

        • 1. Re: Problem with rich:calendar internet explorer7
          ilya_shaikovsky

          filterValueInput facet is not documented and was not intended for direct usage. That's why It was not tested for full support of rich:* controls inside (there is problems with them as them not have focus() defined).

          • 2. Re: Problem with rich:calendar internet explorer7
            garriweb

            Thank you,

             

                            I figured out a workaround for my problem overwriting the method addInplaceInput(FacesContext context, UIComponent column) in AbstractExtendedTableRenderer.java in my project so it sets the focus to InputDate in case it is a rich:calendar:

             

            protected void addInplaceInput(FacesContext context, UIComponent column) throws IOException {

                    UIInput filterValueInput = (UIInput) column

                            .getFacet(FILTER_INPUT_FACET_NAME);

                    if (null == filterValueInput) {

                        filterValueInput = (UIInput) context.getApplication()

                                .createComponent(UIInput.COMPONENT_TYPE);

                        filterValueInput.setId(column.getId() + SORT_FILTER_PARAMETER);

                        filterValueInput.setImmediate(true);

                        filterValueInput.getAttributes().put(HTML.STYLE_CLASS_ATTR, "rich-filter-input");

                        column.getFacets().put(FILTER_INPUT_FACET_NAME, filterValueInput);

                        filterValueInput.getAttributes().put(HTML.onclick_ATTRIBUTE,

                                "Event.stop(event);");

                    }

                    String filterEvent = (String) column.getAttributes().get("filterEvent");

                    if (null == filterEvent || "".equals(filterEvent)) {

                        filterEvent = "onchange";

                    }

             

                    String buffer = buildAjaxFunction(

                            context,

                            column,

                            false,

                            buildSetFocusFunctionDef(filterValueInput.getClientId(context)));

             

                   if(filterValueInput.getRendererType().equalsIgnoreCase("org.richfaces.CalendarRenderer")){

                        buffer = buffer.replace(filterValueInput.getClientId(context), filterValueInput.getClientId(context)+"InputDate");

                    }

             

             

                    filterValueInput.getAttributes().put(filterEvent, buffer);

                    filterValueInput.setValue(column.getAttributes().get("filterValue"));

             

                    getUtils().encodeBeginFormIfNessesary(context, column);

                    renderChild(context, filterValueInput);

                    getUtils().encodeEndFormIfNessesary(context, column);

                }

            • 3. Re: Problem with rich:calendar internet explorer7
              m.a.g

              We are wating for "filterValueInput" feature - https://jira.jboss.org/jira/browse/RF-7582