3 Replies Latest reply on Sep 14, 2018 6:40 AM by jareeq

    [Apex 18.1] IG text column as link

    jareeq

      Hi,

       

      Trying to get behavior like this:

      Editable IG with TICKET column that is editable text field working as url to ticket (hidden link column)

       

      Now problem is that setting Target as &LINK. in Text field TICKET and Link text as &TICKET. it works like link until editing field. Then link functionality is lost.

      You can reproduce this here (demo/demo1):

      https://apex.oracle.com/pls/apex/f?p=72642:1

      Simply click on TIC_0002 it will open new window with.www.oracle.com. Now try to edit that field even without saving then try to click link once again - it loses 'link ability'.

      Can you give some advise how get link still working after field update (and not adding it to second column) ?

       

      Thanks

        • 1. Re: [Apex 18.1] IG text column as link
          fac586

          jareeq wrote:

           

          Trying to get behavior like this:

          Editable IG with TICKET column that is editable text field working as url to ticket (hidden link column)

           

          Now problem is that setting Target as &LINK. in Text field TICKET and Link text as &TICKET. it works like link until editing field. Then link functionality is lost.

           

          You can reproduce this here (demo/demo1):

          https://apex.oracle.com/pls/apex/f?p=72642:1

          Simply click on TIC_0002 it will open new window with.www.oracle.com. Now try to edit that field even without saving then try to click link once again - it loses 'link ability'.

          Can you give some advise how get link still working after field update (and not adding it to second column) ?

          Interactive Grids are modal. When edit mode is activated by selecting the Edit button, tapping or clicking on TICKET column values sets input focus in that cell rather than opening the link target. Deselecting the Edit button restores the link behaviour.

          • 2. Re: [Apex 18.1] IG text column as link
            John Snyders-Oracle

            Hi,

            Do I understand correctly that you want to be able to edit the link label/text and not the target url of the link?

             

             

            If so your sample seems to work fine. As already pointed out just leave edit mode. You can press Escape key or Click Edit button.

             

            You can use a link on a text field as you have shown with a target of &LINK. but it is a little inefficient because the URL is duplicated in the JSON data. May not be a big deal or maybe it is if there are many records or the urls are very long.

            If you dig into the data model or look at the data in the ajax request you will see the url in the LINK column and in the record metadata column url property.

            From the console something like this will show you the data:

            apex.region("your-static-id").call("getCurrentView").model._data[0]

             

            A better way is to use the advanced column configuration options.

            The Ticket column should be a text field. Don't define a link at all. Add this to advanced JavaScript Initialization Code:

            function(config) {

                config.defaultGridColumnOptions = {

                    linkTargetColumn: 'LINK',

                    linkAttributes: 'target="_blank"'

                };

                return config;

            }

             

            See preview API doc https://docs.oracle.com/database/apex-18.1/AEXJS/grid.html#columns for more info.

            Now if you look at the data again you will see that the URL is in the record just once in the column value.

             

            Regards,
            -John

            • 3. Re: [Apex 18.1] IG text column as link
              jareeq

              Thanks guys for reply.

              @fac586 you have absolutely right with edit mode. But ... our users do not differ between edit disabled and enabled they want to check as soon as save button was pressed.

              Maybe there is option to disable Edit mode automatically right after Save ?

               

              @John thanks for that advice. Indeed this is redundancy I'm still not great familiar with data model and JS API possibilities in  apex :-)