Menu

Dynamic columns, or Define Columns at Runtime

2004-09-21
2012-10-09
  • matt_dowell

    matt_dowell - 2004-09-21

    We have added this functionality and I would like to see if we can merge our changes so we can keep up on all the good development being done.

    Here is an example of how you use it:

    <display:table name="requestScope.test" id="table" requestURI="/goforit">
    <display:columnList columnList="requestScope.columns" />
    </display:table>

    Here is a summary of the changes we made to support this (minor, easy changes):

    1) Create a ColumnListTag...
    public class ColumnListTag extends AbstractColumnTag { ...

    2) Create an AbstractColumnTag...
    public abstract class AbstractColumnTag extends TemplateTag {
    a) This holds all the common tag information between the EL and non EL versions.

    3) Create an interfaces package with this class in it: public interface DisplayTagColumn {
    a) Copy all the relative methods to this interface

    4) Make HeaderCell, HeaderCellImpl, and AbstractDisplayColumn implement the DisplayTagColumnInterface

    Make small changes throughout the code to refer to the interface instead of the concrete classes and you are good to go.

    I am willing to submit my code if anyone thinks this is useful, maybe it's just me ;)

    Matt Dowell

     
    • Marko Simic

      Marko Simic - 2004-09-26

      I am very intersted how to dynamicly set columns for displaytag. Is it the only solution, you posted here (or better to say, you're willing to post :)) or there are some "standardized" way to do it.
      Do you know any online example?

       
      • matt_dowell

        matt_dowell - 2004-10-25

        I am currently using my solution in production and it seems to work well. If anyone wants the source code I will be happy to zip it up and send it. Just reply with your email add.

         
        • Emanuele P.

          Emanuele P. - 2004-10-26

          Hi! I am interested to the code you wrote. Can you send it to me at emanuelep@users.sourceforge.net?
          Thanks! So, did you extend the current library defining a new tag columnList? I think that I need to add the new library, too, right?

          Emanuele

           
          • matt_dowell

            matt_dowell - 2004-10-26

            Whomever wants the source package, can you email me directly at mdowell -at- gmail.com

            I have tried responding to a few of you and the server will not let it through. Thanks.

            Matt

             
    • Krishna

      Krishna - 2004-10-12

      I require something like this to be able to give the functionality to the managers to be able to define their reports by selecting the fields they would like to see in their reports. Would be a great addition..

      I am sure other people would also appreciate this feature.. can you please checkin the code or maybe if its too insignificant, could you please email
      the code to me kris7077@yahoo.com

      appreciate all the good work

      thanks
      kris

       
    • russell_giebelhaus

      This functionality would be extremely useful in our project. We want the ability to have user defined table layouts.
      Are there plans to have this code included within the display tag library code?

      My vote is to have Matt submit his code.

      Russell Giebelhaus

       
    • Sri

      Sri - 2004-10-05

      When you can specify dynamic columns, can you also specify sorting on each column?

      Sri

       
      • matt_dowell

        matt_dowell - 2004-10-05

        Yes, your ColumnImpl class would implement all the methods / attributes that displaytag needs.

         
    • Sri

      Sri - 2004-10-06

      Can you be more specific. May be include the code like the one on your first email...

      <display:table name="requestScope.test" id="table" requestURI="/goforit">
      <display:columnList columnList="requestScope.columns" />
      </display:table>

      How do you specify sorting attribute to the above lines...Any help is greately appreciated...
      Sri

       
    • matt_dowell

      matt_dowell - 2004-10-25

      ..and I forgot to mention, it is backwork compatable.

       
    • matt_dowell

      matt_dowell - 2004-11-11

      Note: I attached the my zipped src package to the JIRA for this.

       

Log in to post a comment.