7 Replies Latest reply on Aug 14, 2014 5:07 PM by Yan Langlois

    ExtendedDataModel / arrangeableState always set to null

    Fred Fred Newbie

      Hi all,

      Having seen the sample of the richfaces 4 online demo, i was interested by the filtering/sorting on the server side.

      The sample with the ExtendedDataModel is very fine, but i ve lot of difficulty to implement it.

       

      In the JPADataModel class, the method 'arrange' is used to set the arrangeableState variable. But In my case, this value is always set to NULL.

       

      Anybody has an idea ? Or anybody seen this problem ?

      It s very blocking When the method createcountcriteria is called. It always raise an null pointer exception.

       

      Thanks

        • 1. Re: ExtendedDataModel / arrangeableState always set to null
          Nick Belaevski Master

          Hi Fred,

           

          Please check that you have defined all necessary component attributes on the page (refer to demo example).

          • 2. Re: ExtendedDataModel / arrangeableState always set to null
            Fred Fred Newbie

            Hi Nick,

            thanks for your reply. Unfortunely I haven't seen your response, so i'm late

             

            here is my code (i've tested it with 4.0.0 final, 4.0.1-SNAPSHOT, 4.1.0-SNAPSHOT)

             

            <h:form id="AuthorForm">

            <a4j:outputPanel id="sample1"> 

              <rich:dataTable id="AuthorDataTable1" rows="10" value="#{MB_Author_Dev.authorDataModel}" var="author" keepSaved="true" iterationStatusVar="iteratorIndex">

             

              <rich:column

                                sortBy="name"

                                sortOrder="#{MB_Author_Dev.sortOrders['name']}"

                                filterExpression="name"

                                filterValue="#{MB_Author_Dev.filterValues['name']}">

             

               <f:facet name="header">

                <h:inputText id="filteringName" name="filteringName" value="#{MB_Author_Dev.filterValues['name']}"/>

               </f:facet> 

                <h:outputText value="#{author.name} #{author.firstname}" id="author_row_id"/>

              </rich:column>

             

                <f:facet name="footer">

                 <rich:dataScroller for="AuthorDataTable1" maxPages="10" id="AuthorDataTableDataScroller1" render="AuthorDataTable1"/>

                </f:facet> 

               </rich:dataTable>

              </a4j:outputPanel> 

            </h:form>


            Do you think I've missed some fields?

             

            The back code is the same as your example. The only thing I've changed:

             

                @Override

                public void arrange(FacesContext context, ArrangeableState state) {

                 syslog.info("[XdDataScroller,arrange] - this method was invoked, state=" + state);

                             arrangeableState = state;

                }

             

            the log is always saying: state=NULL ...

             

             

            Thanks again Nick.

            Regards Fred

            • 3. Re: ExtendedDataModel / arrangeableState always set to null
              Fred Fred Newbie

              Nick,

                one precision. I've copied/paste some of your code. It's working... the state is NOT null.

               

              "

              INFO: [XdDataScroller,arrange] - this method was invoked, state=org.richfaces.model.ArrangeableStateDefaultImpl@a4b975

              "

               

              You were right. But I don't see my mistake. It's working when I use the "JPAColumn.xhtml" code. I'll check it.

              Thanks again

               

              Best Regards

              Fred

              • 4. Re: ExtendedDataModel / arrangeableState always set to null
                Fred Fred Newbie

                Hi,

                i've found it.

                 

                Instead of:

                <rich:column

                                    sortBy="name"

                                    sortOrder="#{MB_Author_Dev.sortOrders['name']}"

                                    filterExpression="name"

                                    filterValue="#{MB_Author_Dev.filterValues['name']}">

                ...

                </rich:column>

                it 's better to do:

                <rich:column

                                                                                                sortBy="#{name}"

                  sortOrder="#{MB_Author_Dev.sortOrders[name]}"

                  filterValue="#{MB_Author_Dev.filterValues[name]}"

                  filterExpression="#{name}"

                                                                                                >

                ...

                </rich:column>

                 

                Fred




                • 5. Re: ExtendedDataModel / arrangeableState always set to null
                  Grzegorz Zalewski Newbie

                  Hi,

                   

                  Could you explain when the arrange method is called or by which component ? If I good understend this method set arrangeableState variable, if so, how to call it ?

                  A lot fo Thanks for any answer.

                   

                  Any one can help ??

                   

                  Thanks,

                  Kiler

                  • 6. Re: ExtendedDataModel / arrangeableState always set to null
                    Grzegorz Zalewski Newbie

                    Hi Nick,

                     

                    Which of component attributes do you exactly think ?

                    I have still this problem, because arrange method is never call and arrangeableState is set to null.

                    • 7. Re: ExtendedDataModel / arrangeableState always set to null
                      Yan Langlois Newbie

                      Hi,

                       

                      The method arrange is called only if your dataModel implements Arrangeable. The component attributes are filterValue and filterExpression of the <rich:column />