4 Replies Latest reply: Jun 12, 2014 2:00 PM by 77Vetter RSS

    Tabular Page Column Header Change at Runtime

    77Vetter

      I have a tabular page in Apex 4.1 and I want to be able to change the column header names when the page loads. We have a separate page where the user defines which columns they want displayed, the order of the columns they want displayed and the display text for the columns. I have everything else working but can't figure out how to change the column header text to match what they have specified.

        • 1. Re: Tabular Page Column Header Change at Runtime
          fac586

          77Vetter wrote:

           

          I have a tabular page in Apex 4.1 and I want to be able to change the column header names when the page loads. We have a separate page where the user defines which columns they want displayed, the order of the columns they want displayed and the display text for the columns. I have everything else working but can't figure out how to change the column header text to match what they have specified.

          How is the column header display text stored?

           

          The simplest way to create dynamic column headings is to set the Headings Type to PL/SQL in the tabular form report attributes and create a PL/SQL function body that returns the required headings as a colon-delimited string.

          • 2. Re: Tabular Page Column Header Change at Runtime
            77Vetter

            Thanks for the pointer. The column display text is stored in the db so I can create a function to return them to the page. I have tried this and not quite sure how this functionality works.

             

            In my current testing scenario the tabular page has 49 actual columns but I have specified to only display 8 of them via a Conditional Display pl/sql function. There is also a jquery function on the page that puts the columns in the specified order.

             

            I have created a function that returns a colon delimited string of the display names for all of the columns on the tabular page regardless if they are displayed\hidden or not. It is returning the column names in the order they are defined in the tabular page. When I tried that I get headings for each column just not the correct headings for the columns that are displayed.

             

            I then changed the function to only return the columns that are displayed (specified by the config page) by the user but then it does not display headings for all columns and again they are not the correct headings for the columns.

             

            I have queried the function in sql and it is working like I suspect but for whatever reason it is not displaying in the Apex page correctly.

             

            With the function returning only the displayed column headings it returns me the following string when running in sqlplus:

            Test1:Test2:Test3:Test4:Test5:Test6:Test7:Test8

             

            Then when I run the page, the first two columns on the tabular page have headings and the rest do not. The first two column headings are Test5 and Test6 which are not the correct headings for those columns. So not sure how I should code the function to return the column headings. I am guessing the timing of the conditional display on the columns, the jquery to move the columns around and then the function to query the column display names is what is causing the issue?

            • 3. Re: Tabular Page Column Header Change at Runtime
              fac586

              Couple of things to check first:

               

              • Which report template are you using? Is it customised?
              • Are there any colons in the generated headings?

               

              Take one step at a time.

               

              • Get all 49 columns in the report definition in the same order as they are in the query.
              • Get the headings function to return the headings in this order.
              • Disable all of the column conditions.
              • Disable the jQuery rearrangement.
              • Run the  report.

               

              Are the headings correct? If they are:

               

              • Reapply a column condition.
              • Run in the report.
              • If the headings are still OK, add the other column conditions, testing as you go.
              • If it's OK when you're back down to the required 8 columns, re-enable the jQuery...

               

              If it all breaks down along the way, suggest you try to reproduce a simplified example on apex.oracle.com so we can see it.

               



              • 4. Re: Tabular Page Column Header Change at Runtime
                77Vetter

                Thanks for your help! I finally figured it out, in my function i had to return headers for EACH of the columns listed in the Report Attributes, including RowSelector and the PK_DISPLAY column that Apex generates.

                 

                Once I added those additional columns it worked great, so thanks again for pointing me in the right direction!