1 2 Previous Next 16 Replies Latest reply: Nov 29, 2012 6:05 AM by 975896 RSS

    Dynamic Content with another page data

    975896
      Hi, congratulations for the forum, it's really didactic.

      I need to load a page in a specific region in Application Express 4.1.1.00.23

      It's possible do that with jQuery? Like the next example?

      $.ajax({  
      url: 'apex page',
      success: function(data) {  
      $('#region').html(data);
      }
      });

      I tried diferent options to load pages in a region with ajax that works in classic html or jquery but I cannot use them in APEX.

      Thanks

      George
        • 1. Re: Dynamic Content with another page data
          714270
          I had a requirement sometime back to load regions from a different page into my current page's region and I followed this example:

          http://apex.oracle.com/pls/otn/f?p=11933:48


          Thanks,
          Rohit
          • 2. Re: Dynamic Content with another page data
            975896
            It works perfect!!!

            I only need:

            In page 48:

            Html heaader and body attributes:

            <script type="text/javascript">
            <!--

            function dhtml_GetReport(pThis){  
            var l_Val = html_SelectValue(pThis);
            var get = new htmldb_Get(null,$x('pFlowId').value,null,47);
            //get.add('P47_DEPT',l_Val)
            gReturn = get.get(null,'<htmldb:BOX_BODY>','</htmldb:BOX_BODY>');
            get = null;
            $x('ReportDrop').innerHTML = gReturn;
            return;
            }

            //-->
            </script>

            Launched with Dynamic Actions (on change / execute javascript):
            dhtml_GetReport(this)

            Container region:

            <div id="ReportDrop">
            (Region header in region attributes)

            </div> (Region footer in region attributes)


            In page 47:

            Region with:

            Region header:

            <htmldb:SUCCESS_MESSAGE><div id="SUCCESS_MESSAGE">#SUCCESS_MESSAGE#</div></htmldb:SUCCESS_MESSAGE>
            <htmldb:NOTIFICATION_MESSAGE><div id="NOTIFICATION_MESSAGE">#NOTIFICATION_MESSAGE#</div></htmldb:NOTIFICATION_MESSAGE>
            <htmldb:GLOBAL_NOTIFICATION><div id="GLOBAL_NOTIFICATION">#GLOBAL_NOTIFICATION#</div></htmldb:GLOBAL_NOTIFICATION>
            <htmldb:REGION_POSITION_01><div id="REGION_POSITION_01">#REGION_POSITION_01#</div></htmldb:REGION_POSITION_01>
            <htmldb:REGION_POSITION_02><div id="REGION_POSITION_02">#REGION_POSITION_02#</div></htmldb:REGION_POSITION_02>
            <htmldb:REGION_POSITION_03><div id="REGION_POSITION_03">#REGION_POSITION_03#</div></htmldb:REGION_POSITION_03>
            <htmldb:REGION_POSITION_04><div id="REGION_POSITION_04">#REGION_POSITION_04#</div></htmldb:REGION_POSITION_04>
            <htmldb:REGION_POSITION_05><div id="REGION_POSITION_05">#REGION_POSITION_05#</div></htmldb:REGION_POSITION_05>
            <htmldb:REGION_POSITION_06><div id="REGION_POSITION_06">#REGION_POSITION_06#</div></htmldb:REGION_POSITION_06>
            <htmldb:REGION_POSITION_08><div id="REGION_POSITION_08">#REGION_POSITION_08#</div></htmldb:REGION_POSITION_08>
            <htmldb:BOX_BODY><div id="BOX_BODY">#BOX_BODY#

            Region footer
            </div></htmldb:BOX_BODY>


            Thank you!

            George
            • 3. Re: Dynamic Content with another page data
              714270
              I am glad that it helped you. However, you can optimize the javascript code in page# 48 as:
              var htmlpiece = $(gReturn).find('#<your-target-region-id>');
              $('#ReportDrop').html(htmlpiece);
              <your-target-region-id> is the Region Static ID of the region in your target page.


              Thanks,
              Rohit
              • 4. Re: Dynamic Content with another page data
                975896
                Hi Rohit

                Like this? :

                <script type="text/javascript">
                <!--

                function dhtml_GetReport(pThis){
                     var l_Val = html_SelectValue(pThis);
                     var get = new htmldb_Get(null,$x('pFlowId').value,null,7);

                     gReturn = get.get(null,'<htmldb:BOX_BODY>','</htmldb:BOX_BODY>');
                     get = null;

                var htmlpiece = $(gReturn).find('#objetive');
                $('#ReportDrop').html(htmlpiece);

                     return;
                }

                //-->
                </script>

                On the other hand I try to send via ajax a tabular form but I cannot connect the buttons with target page. I need some type of ajax callback to operate in the dynamic region?


                Thanks.

                George
                • 5. Re: Dynamic Content with another page data
                  714270
                  Hi,

                  Your javascript looks good to me. I believe, "objetive" is the region static id of your target region. However, please enclose your code in
                   tags to make them more readable (read forum FAQs).
                  
                  I am not sure I understand your other question correctly. What do you mean by "cannot connect the buttons with target page"?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                  • 6. Re: Dynamic Content with another page data
                    975896
                    Hi

                    If I optimize the code it doesn't work.

                    I mean that if you load a tabular form in dynamic region you can show it but you can't use the functionalities because it doesn't execute the javascript code and processes of the origin page.


                    Regards

                    George
                    • 7. Re: Dynamic Content with another page data
                      714270
                      Make sure that the region static id of your target region (in page# 7) is "objetive".
                      Secondly, just use alert(htmlpiece) in your JS code to see what it is returning.

                      If the javascript in your target page is not working, make sure that you have included the following Substitution strings in the "header" region of your page template:
                      #APEX_JAVASCRIPT#
                      #TEMPLATE_JAVASCRIPT#
                      #APPLICATION_JAVASCRIPT#
                      #PAGE_JAVASCRIPT#
                      • 8. Re: Dynamic Content with another page data
                        975896
                        Static id is "objective"

                        Alert returns: [object Object]

                        I edit header page template:
                        type="text/css" />
                        #HEAD#
                        #APEX_JAVASCRIPT#
                        #TEMPLATE_JAVASCRIPT#
                        #APPLICATION_JAVASCRIPT#
                        #PAGE_JAVASCRIPT#
                        </head>
                        <body #ONLOAD#>#FORM_OPEN#

                        But unfortunately it doesn't work. Tabular form can't execute delete, submit and addrow buttons (and processes) because the tabular is in page 47 but I shows it in page 48

                        Thanks

                        George
                        • 9. Re: Dynamic Content with another page data
                          714270
                          There is then a typo in the code (look at the static id):
                          var htmlpiece = $(gReturn).find('#objetive');
                          In your page template, where are you opening the <head> tag?

                          BTW, not sure why the page process are not working. Could you create an example in apex.oracle.com for this issue?
                          • 10. Re: Dynamic Content with another page data
                            975896
                            Hi Rohit

                            Sorry it's my fault but only in forum, in page I have a correct id.

                            BTW I mean this:

                            http://apex.oracle.com/pls/apex/f?p=60712:48

                            http://apex.oracle.com/pls/apex/f?p=60712:47

                            User/pass demo/demo

                            You can see that in page 47 the tabular form works fine but when you load it with ajax in page 48 you can't use the functionalities.


                            Thank you

                            George
                            • 11. Re: Dynamic Content with another page data
                              714270
                              Hi George,

                              I saw the issue as nothing seem to work in page# 48. I cannot comment much unless you share the developer credentials of your workspace.
                              There seem to be something wrong/missing in the page template that you are using for page# 48.



                              Thanks,
                              Rohit
                              • 12. Re: Dynamic Content with another page data
                                975896
                                Hi

                                I activate the developer privilegies to demo/demo


                                Regards

                                George
                                • 13. Re: Dynamic Content with another page data
                                  714270
                                  What's your workspace name?
                                  • 14. Re: Dynamic Content with another page data
                                    975896
                                    Sorry.

                                    GEORGEDEMO
                                    1 2 Previous Next