{"id":822,"date":"2025-02-23T15:33:38","date_gmt":"2025-02-23T14:33:38","guid":{"rendered":"https:\/\/ilmarkerm.eu\/blog\/?p=822"},"modified":"2025-02-23T15:33:38","modified_gmt":"2025-02-23T14:33:38","slug":"set-apex-interactive-grid-in-edit-mode-on-page-load-and-scroll-page-pack-to-top","status":"publish","type":"post","link":"https:\/\/ilmarkerm.eu\/blog\/2025\/02\/set-apex-interactive-grid-in-edit-mode-on-page-load-and-scroll-page-pack-to-top\/","title":{"rendered":"Set APEX Interactive Grid in edit mode on page load AND scroll page pack to top"},"content":{"rendered":"\n<p>To enable edit mode on Interactive Grid immediately when page loads (to save users a double click), you can create a dynamic action to run custom JavaScript on page load:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set <strong>Static ID<\/strong> on your Interactive Grid region &#8211; lets call it <strong>MYIG1<\/strong><\/li>\n\n\n\n<li>Create a <strong>Dynamic Action<\/strong> on event <strong>Page Load<\/strong> and on True event let it execute the following JavaScript Code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>apex.region(\"MYIG1\").call(\"getActions\").set(\"edit\", true);<\/code><\/pre>\n\n\n\n<p>Up to this part all is well and if you page is not very log, problem solved. But if the page is longer you will notice a side-effect &#8211; the page gets automatically scrolled to set focus on the Interactive Grid. To fix it append a scroll up code to the JavaScript snippet above, so a full example would look like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apex.region(\"MYIG1\").call(\"getActions\").set(\"edit\", true);\n$(\"html, body\").delay(500);\n$(\"html, body\").animate({ scrollTop: 0 },0);<\/code><\/pre>\n\n\n\n<p>That little bit of delay is necessary, otherwise scrolling will not work. It will also introduce a little bit of &#8220;page flickering&#8221;, but at least the page focus is back on top when page is loaded.<\/p>\n\n\n\n<p>Tested with APEX 24.2.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To enable edit mode on Interactive Grid immediately when page loads (to save users a double click), you can create a dynamic action to run custom JavaScript on page load: Up to this part all is well and if you page is not very log, problem solved. But if the page is longer you will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[21],"class_list":["post-822","post","type-post","status-publish","format-standard","hentry","category-blog-entry","tag-apex"],"_links":{"self":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/comments?post=822"}],"version-history":[{"count":1,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/822\/revisions"}],"predecessor-version":[{"id":823,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/822\/revisions\/823"}],"wp:attachment":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/media?parent=822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/categories?post=822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/tags?post=822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}