6 Replies Latest reply on Mar 10, 2011 10:29 PM by bking007

    Excel exporter and richfaces filter

    yanmania

      Hi,


      When I export a rich:dataTable into an Excel file, I export all the dataTable even if I filtered my dataTable (with richfaces filters). Is it the correct behavour ? Is it a bug ? Is there a workaround ?


      Yan.

        • 1. Re: Excel exporter and richfaces filter
          nickarls

          I'm not that familiar with RF but it sounds like something that sits between the component and the value EL target. The exporter is a general component targetted mostly at the h:dataTable so features of e.g. rich:dataTable or ice:dataTable might not be automagically recognized.


          One workaround would be to provide a second dataset, filtered in the same way as the dataTable (but applied directly on the getter result)

          • 2. Re: Excel exporter and richfaces filter
            bking007

            I have the same issue here. Couldn't find any resolution yet..my table is huge and having another dataset is not a right option I believe..

            • 3. Re: Excel exporter and richfaces filter
              kragoth

              I recently replied to a thread asking the same question and said basically It is not a bug, and it is doing exactly what it is supposed to do and that if you want to export your filtered dataset then you need to do that work yourself.


              Now, what I said is 99% correct. However, the question remains. How should you do this work in such a way that you feel like you have achieved an elegant solution and not just a hacked up copy of the filtering process?


              It is amazing what a little bit of logical searching can do.


              You are asking about a richfaces component and so...I searched filter export on the richfaces forum (which is where this question should be mind you). Search Results


              The second result in that search led me to this thread


              Which said:


              you should implement your custom model to work with filtered and sorted data as you need. check modifiable model sample at livedemo.
              



              So, off to the livedemo page we go and look at the datatable modifiable model example here


              So, now you are going to have to do the rest of the leg work and actually work out how to do what they said.


              These links might help.



              1. Another forum post

              2. Someone's solution (not what you want, but just some food for thought) here

              • 4. Re: Excel exporter and richfaces filter
                kragoth

                ...the richfaces forum (which is where this question should be mind you).


                I was probly a bit harsh with that comment. I understand it would be easy to assume the Seam export is at fault here. But, it's not. The dataset you've provided to the export just hasn't had the filter applied to it is all.


                Anyways, following my above comments should end up working for you.

                • 5. Re: Excel exporter and richfaces filter
                  kragoth

                  Well...I should have searched a bit longer sigh


                  JIRA RF-6280 describes this problem as a known issue.


                  So....maybe everything I said earlier is hogwash anyway. :)


                  Still....there is a chance that implementing your own data model will work. As far as I can tell the Seam exporter bean grabs an iterator on the datamodel and keeps calling next for each row. So...in theory it should work ;)

                  • 6. Re: Excel exporter and richfaces filter
                    bking007

                    Thanks for your helpful suggestions and links. However, when the datatable gets filtered (automatically on pressing tab, or hitting enter), what happens to the old collection? Does it get updated with new model data? still a bit confusing. never mind, i will update this post with my results shortly.