<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrew Bennett on Medium]]></title>
        <description><![CDATA[Stories by Andrew Bennett on Medium]]></description>
        <link>https://medium.com/@andrewpbennett92?source=rss-e5f320f430b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HAGIcxsSwDK9p_tjAUOWdg.jpeg</url>
            <title>Stories by Andrew Bennett on Medium</title>
            <link>https://medium.com/@andrewpbennett92?source=rss-e5f320f430b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:20:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andrewpbennett92/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Oracle JET Slack]]></title>
            <link>https://medium.com/@andrewpbennett92/oracle-jet-slack-1f1957e61e2a?source=rss-e5f320f430b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f1957e61e2a</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-jet]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <dc:creator><![CDATA[Andrew Bennett]]></dc:creator>
            <pubDate>Sun, 22 Sep 2019 17:13:22 GMT</pubDate>
            <atom:updated>2019-09-22T17:13:22.097Z</atom:updated>
            <content:encoded><![CDATA[<p>I thought it was about time information started getting shared about what people are doing with Oracle JET. I’ve made a slack channel for people to join.</p><p>Use this space to share what you are doing, cool things that you / your company are looking at, and ask for general help that you need.</p><p>There are a lot of people with a very good knowledge of JET and general web development, use this to see how you can improve your practices and push the work you are doing in a positive direction. Nobody likes to become stale, the best way to get new ideas is to share what you are doing.</p><p><strong>Want Access? Sign up with this link </strong><a href="https://oracle-jet-slack-invite.herokuapp.com/">https://oracle-jet-slack-invite.herokuapp.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*TgNV1N_951TNNdI11_5oGQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f1957e61e2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Babel Configuration in Oracle JET Applications]]></title>
            <link>https://medium.com/@andrewpbennett92/babel-configuration-in-oracle-jet-applications-820b5f32a58a?source=rss-e5f320f430b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/820b5f32a58a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-jet]]></category>
            <category><![CDATA[babel]]></category>
            <dc:creator><![CDATA[Andrew Bennett]]></dc:creator>
            <pubDate>Mon, 01 Oct 2018 07:25:33 GMT</pubDate>
            <atom:updated>2018-10-01T07:25:33.552Z</atom:updated>
            <content:encoded><![CDATA[<p>More often than not, you will find yourself writing Javascript and thinking to yourself, is this actually valid syntax for the browsers my application is supposed to support? To save yourself this headache, babel can be used to transpile your latest and greatest code into it’s equivalent counterpart that works with older browsers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExrW2ohRIyDlXR4LldRp6A.png" /></figure><h3>Getting Started</h3><p>The below will install the babel command line tool, and also a preset environment package. The preset environment is a convenience to get you setup without having to worry about all the smaller pieces underneath. If you want full control of everything then feel free to delve into the documentation and omit the preset environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Ru1hcCDkx6rtSOy1Ay-S_g.png" /></figure><p>Next we want a configuration file where we can manage the versions of browsers that we want to support, and also state that we want to use the preset environment that we have just installed.<br>Create a file called .babelrc in the root of your project (on the same level as the package.json file). The following is a base to work off, read through the documentation and adjust for the needs of your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*IjtXdc5qW-85h0TG80UtGQ.png" /></figure><h3>Scripts</h3><p>Now that everything is in place, we want a script to run the transpilation on our code base. The easiest way to do this is through an npm script, so in the package.json file add a scripts section if you do not already have one. See below for a sample script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CF5Hbd1rSMwsblxCGEJQug.png" /></figure><p>What this script will do is take all the Javascript in your web/js directory, transpile the code, and replace the file contents in web/js. You don’t want to be transpiling code in your src directory, otherwise you will have lost all your cool syntax.</p><p>The -- ignore flag can be used to ignore certain files or folders from babel being run on it, you might have noticed in the .babelrc file there was a section for ignoring files, at the time of writing there is a bug with the .babelrc file so we need to specify this in the ignore argument for the moment.</p><h3>Hooking into build scripts</h3><p>To quickly recap, we have installed babel to our project, and got a script that will transpile Javascript code found in the web/js directory. Now we need to plug this into the build tasks to make it part of the development lifecycle.</p><p>In the scripts/hooks directory you will find a file called after_build.js that will execute once your code has been copied over from src to web, injections, and all the other tasks that are performed when you run ‘ojet build’.</p><p>Within this build hook, we are going to execute the npm script that we created in our package.json file. If there was any errors then it will reject the Promise causing the build to fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*Xtz5AJfa3hXbIu5kq0fPYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*AvXfVxZH7Rg39SRTrij4ew.png" /><figcaption>Transpiled code before it marks the build as finished</figcaption></figure><p>This hook will only execute when you run the build or serve command, and will not run with the livereload watcher task. As you are developing, ideally you want to see the transpiled code in the browser, maybe it’s just me being always skeptical but I want to see the instant results of the transpiled code rather than only seeing it on a full build.</p><p>In order to achieve this, we will need to extend the watcher task in the serve process. You will find a file called oraclejet-serve.js in the scripts/config directory, and inside this file is some commented out code. Part of the commented out code is the watcher task which can be extended to run a command when one of the main source files changes. Now every time you make a change in the src directory and it’s copied over the babel scripts will get executed again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_PPTvyspNQIG7_b-OzI6w.png" /></figure><p>This is a personal preference extension, as it will run the babel command on your entire web directory again. Currently there isn’t a way to extract just the 1 file that’s changed. It doesn’t add much time on to the browser reload but there is a slight delay while babel is getting run again, I appreciate this slight delay might not be for everybody.</p><h3>Example Transpilation</h3><p>Taking a simple example of arrow functions, these are fully supported in Chrome and Firefox, but not in Internet Explorer obviously. <a href="https://caniuse.com/#feat=arrow-functions">https://caniuse.com/#feat=arrow-functions</a></p><p>If you use arrow functions in your viewModel, and have Internet explorer defined in your .babelrc file as a browser to support, then it will convert the arrow function back to the standard function declaration. However, if we take out the Internet Explorer reference from our .babelrc file and compile the code again, you will see that it keeps the arrow function as it’s supported in the browsers that we listed.</p><h3>ES6 Style Modules</h3><p>Now that you can safely start writing ES6+ code without worrying about compatibility issues, you may want to write some of your files using the ES6 module syntax with function exports etc.</p><p>A little more consideration needs to be had here when using Require.js, and actually needs another dependency to your application.</p><p><a href="https://www.npmjs.com/package/requirejs-babel">requirejs-babel</a></p><p><em>Disclaimer, I haven’t used this plugin for a real project yet. Proof of concept only to see if it would work.</em></p><p>Once installed, you can add references to ‘es6’ and ‘babel’ in your path_mapping.json file so that they become part of your RequireJs config block on build.</p><p>To load a file that is using the export.function functionality you will need to prefix the module name in your define blocks with es6! so that the module load uses the plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*hFr0SZtDDLZFaITCKo8IPw.png" /><figcaption>Entries similar to this should appear in your RequireJs config block</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OfKFGUz5yd2tVRqk-aG8MQ.png" /><figcaption>ES6 module load prefixed with es6! to load it properly</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=820b5f32a58a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oracle JET table, row selection using arrow keys]]></title>
            <link>https://medium.com/@andrewpbennett92/oracle-jet-table-row-selection-using-arrow-keys-eb8cf8d5f30a?source=rss-e5f320f430b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb8cf8d5f30a</guid>
            <category><![CDATA[oracle-jet]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Andrew Bennett]]></dc:creator>
            <pubDate>Thu, 21 Sep 2017 09:19:28 GMT</pubDate>
            <atom:updated>2017-10-06T08:29:06.085Z</atom:updated>
            <content:encoded><![CDATA[<p>A common requirement when using tables to display data is the ability to traverse rows using the up and down arrow keys to change selection. You may have another section on the screen displaying additional data for the selected row, so why force the end user to have to use the mouse?</p><p>This is not the default behaviour as of version 3.1.0, which took me by surprise having come from using ADF. Although there is no simple attribute to add onto the ojTable data bind, there is support to achieve this without having to write some crude javascript by leveraging the table events.</p><pre>&lt;table id=&quot;myTable&quot; summary=&quot;Test Table&quot; aria-label=&quot;Test Table&quot;<br>   data-bind=&quot;ojComponent: {component: &#39;ojTable&#39;,<br>   data: datasource,<br>   columnsDefault: {sortable: &#39;enabled&#39;},<br>   selectionMode: {row : &#39;single&#39;},<br>   columns: [<br>      {headerText: &#39;Department ID&#39;, field: &#39;DepartmentId&#39;},<br>      {headerText: &#39;Department Name&#39;, field: &#39;DepartmentId&#39;},<br>      {headerText: &#39;Department Manager&#39;, field: &#39;DepartmentId&#39;}<br>   ]}, <br>   hasFocus: true&quot;&gt;<br> &lt;/table&gt;</pre><p><em>Extra: Within the $(document).ready section below, there is a snippet of code that will set the default row of the table to be the first row. This is documented in the JS docs but it caught me out by not specifying that if it isn’t put within the document ready function then it does not attach to the table properly, leaving the initial row selection to not be set.</em></p><pre>function beforeCurrentRowListener(event, data)<br> {<br>   var newCurrentRow = data.currentRow;<br>   <br>   var rowIndex = newCurrentRow.rowIndex;<br>   $(&quot;#myTable&quot;).ojTable(&quot;option&quot;, &quot;selection&quot;, <br>         [{startIndex: {&quot;row&quot;:rowIndex}, <br>           endIndex:{&quot;row&quot;:rowIndex}}]);<br> }</pre><pre>$(document).ready(<br>   function()<br>   {<br>     $(&quot;#myTable&quot;).ojTable({<br>        &quot;ready&quot;: function () {<br>          $(&quot;#myTable&quot;).ojTable(&quot;option&quot;, &quot;selection&quot;, <br>               [{startIndex: {&quot;row&quot;: 0},<br>                 endIndex: {&quot;row&quot;: 0}}<br>               ]<br>            );<br>        }<br>     });</pre><pre>   $(&#39;#myTable&#39;).on(&#39;ojbeforecurrentrow&#39;,beforeCurrentRowListener);<br>   }<br> );</pre><p>Oracle JET tables have the concept of a current row, and a selected row. The selected row is as expected, the row that was selected. The current row is what currently has the dotted border around it as seen in the image below. This does not mean that row is active, and is what happens OOTB when you press arrow up/down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*_n0o2L42uzXES--svYE9wA.png" /></figure><p>To make the current row the selected one we make use of the ojbeforecurrentrow event documented here: <br> <a href="http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.ojTable.html#event:beforeCurrentRow">http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.ojTable.html#event:beforeCurrentRow</a></p><p>This will capture when the current row changes, providing you with the index of the row. This information can then be used in conjunction with set row selection to change the selected row to the current row <a href="http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.ojTable.html#selection">http://www.oracle.com/webfolder/technetwork/jet/jsdocs/oj.ojTable.html#selection</a></p><p>That is everything that you need to do in order to get row selection working with arrow keys in JET tables. Register a function to run when the ojbeforecurrentrow event is published, in the function extract the current row index and set the selected row index to it.</p><p><strong>Additional</strong></p><p>If you have optionChange registered on your table to run a function when row selection happens, this this will automatically get run as part of the programatic row selection within the beforeCurrentRowListener function.</p><p>If you don’t want instant row selection, and are interested in being able to traverse current rows and have selection using an enter event then see below.</p><pre>&lt;table id=&quot;myTable&quot; summary=&quot;Test Table&quot; aria-label=&quot;Test Table&quot;<br>   data-bind=&quot;ojComponent: {component: &#39;ojTable&#39;,<br>   data: datasource,<br>   columnsDefault: {sortable: &#39;enabled&#39;},<br>   selectionMode: {row : &#39;single&#39;},<br>   columns: [<br>      {headerText: &#39;Department ID&#39;, field: &#39;DepartmentId&#39;},<br>      {headerText: &#39;Department Name&#39;, field: &#39;DepartmentId&#39;},<br>      {headerText: &#39;Department Manager&#39;, field: &#39;DepartmentId&#39;}<br>   ]}, <br>   hasFocus: true,<br>   event: {keypress: enterEvent}&quot;&gt;<br> &lt;/table&gt;</pre><p>What has been added is a generic knockout keypress event on the table, this is not to be added within the ojComponent braces. The function that the keypress event is bound to checks to see if it was enter pressed, if so then it will set the selected row in the same way that the ojbeforecurrentrow event did.</p><pre>self.enterEvent = function(data ,event){<br>   if (event.keyCode === 13){<br>     var currentIndex =<br>     $(&quot;#myTable&quot;).ojTable(&quot;option&quot;,&quot;currentRow&quot;).rowIndex;</pre><pre>     $(&quot;#myTable&quot;).ojTable(&quot;option&quot;, &quot;selection&quot;, <br>       [{startIndex: {&quot;row&quot;:currentIndex}, <br>         endIndex:{&quot;row&quot;:currentIndex}}]);<br>   }<br>   return true;<br> };</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb8cf8d5f30a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>