2 Replies Latest reply on Jun 14, 2011 7:25 AM by nijinsky

    dataTableEdit of sample is bug?

    nijinsky

      When the following procedures are done, it doesn't operate normally.

      Is there a method of settlement?


      step1.http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=dataTable&sample=dataTableEdit&skin=blueSky

      step2.[edit]grafic click

      step3.English is input to price textbox.

      step4.[store]button click

      step5.The message[Should be a valid price] is displayed.

      step6.[cancel]button click

      step7.other [edit]button click

      step8.The value has not been changed. 


      Because the value is set in [carsBean.editedCar], it is displayed in < h:outputText >.

      However, the value has not changed in <h:inputText>.

        • 1. Re: dataTableEdit of sample is bug?
          ilya_shaikovsky

          please rise an issue.. it's just application problem related to http://ishabalov.blogspot.com/2007/08/sad-story-about-uiinput.html

          1 of 1 people found this helpful
          • 2. Re: dataTableEdit of sample is bug?
            nijinsky

            Thank you Ilya Shaikovsky.

             

            The explanation of the site was regrettable.

            However, it was possible to solve it from the sample of measures by the following methods.

             

            ------------------------------------------------------------------------------------------------------------------------------------------

            ---CarsBean------------------------------------------------------------------------------------------------------------------------

            ------------------------------------------------------------------------------------------------------------------------------------------

             

            public void hide(String parentId){

                      clear(parentId);

            }

             

            private void clear(String parentId){

                      FacesContext context = FacesContext.getCurrentInstance();

                      UIComponent component = context.getViewRoot().findComponent(parentId);

             

                      Map<String, UIInput> inputComponents = new HashMap<String, UIInput>();

                      findComponent(component,inputComponents);

             

                      UIInput input = null;

                      for(Map.Entry<String, UIInput> entry : inputComponents.entrySet()) {

                          input = entry.getValue();

             

                                input.setSubmittedValue(null);

                                input.setValue(null);

                      }

            }

             

            private void findComponent(UIComponent component, Map<String, UIInput> inputComponents) {

                      if (component instanceof UIInput) {

                                inputComponents.put(component.getClientId(), (UIInput) component);

                      }

             

                      Iterator<UIComponent> child = component.getFacetsAndChildren();

             

                      while (child.hasNext()) {

                                findComponent(child.next(),inputComponents);

                      }

            }

            ------------------------------------------------------------------------------------------------------------------------------------------

             

            ------------------------------------------------------------------------------------------------------------------------------------------

            ---dataTableEdit-sample.xhtml-----------------------------------------------------------------------------------------------

            ------------------------------------------------------------------------------------------------------------------------------------------

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                      xmlns:h="http://java.sun.com/jsf/html"

                      xmlns:f="http://java.sun.com/jsf/core"

                      xmlns:ui="http://java.sun.com/jsf/facelets"

                      xmlns:a4j="http://richfaces.org/a4j"

                      xmlns:rich="http://richfaces.org/rich"

             xmlns:util="http://java.sun.com/jsf/composite/components/util">

             

                      <rich:popupPanel header="Edit Car Details" id="editPane" domElementAttachment="parent" width="400" height="170">

                               <util:panel id="samplePanel">

             

                           <a4j:commandButton value="Cancel"

                               action="#{carsBean.hide('form:samplePanel')}"  immediate="true"

                                                    oncomplete="#{rich:component('editPane')}.hide(); return false;" />

             

                      </util:panel>

            </rich:popupPanel>

            ------------------------------------------------------------------------------------------------------------------------------------------

             

             

            ------------------------------------------------------------------------------------------------------------------------------------------

            ---/resources/util/panel.xhtml-------------------------------------------------------------------------------------------------

            ------------------------------------------------------------------------------------------------------------------------------------------

            <html

                      xmlns="http://www.w3.org/1999/xhtml"

              xmlns:a4j="http://richfaces.org/a4j"

              xmlns:composite="http://java.sun.com/jsf/composite">

             

                      <composite:interface>

                      </composite:interface>

             

                      <composite:implementation>

                  <a4j:outputPanel>

                        <composite:insertChildren />

                </a4j:outputPanel>

                      </composite:implementation>

            </html>

            ------------------------------------------------------------------------------------------------------------------------------------------

             

            It has not understood though it only has to provide the function like "prependId" of "h:form" in tag.

            Therefore, [/resources/util/panel.xhtml]was added.

             

            Please refer though it is thought that it is possible to improve it still.