This crash course will teach you the basics of JavaScript so that you can get started creating your own dynamic web content. While JavaScript is a simple language, it can be difficult to get started with if you're not familiar with programming concepts. is a programming language that enables you to create dynamically updated content, control multimedia, animate images, and much more. However, as it is quite a good thing in ABAP, here’s an example for the exception handling in JavaScript. Var oDateConverted = new Date(parseInt(jStrDate.substr(6))) Ĭonsole.log('Date conversion - ', oDateConverted.toDateString()) Īpplication exceptions appear to be rarely used in JavaScript. JSON DateTime: /Date(1224043200000)/ To convert it into a readable format, you can use the following code. In JSON the dateTime data type is represented as an integer, like the following. One common problem with JSON is the conversion of the dates. Note, JSON can only carry properties (names and values), not the functions. Var jStrFromObj = JSON.stringify(oLaptop) Ĭonsole.log('Render an object to JSON - ', jStrFromObj) var jStrFromArr = JSON.stringify(aMaterialTable) Ĭonsole.log('Render an array to JSON - ', jStrFromArr) To render an array (or any other object) to JSON you can use the stringify() function. var oJSON = jQuery.parseJSON(jStr) // alternative way of parsingĬonsole.log( 'parse JSON to object - ', oJSON ) You can create a function object by means of the following function expression: var f = function () ' This is why you can declare and assign them to a variable. The “var” best practice tells us always to put the declarations before the executable function code. In a UI5 project the first requirement will be pretty much always satisfied, as you will be developing within the set of predefined functions. For that, you basically should do two things – define one global object and put all your application into that object, and always declare variables using “ var”. The next thing you should take care of is minimizing of the global variables. You should do it in the beginning of each block. Most of the browsers use F12 to activate/deactivate the console windowĬonsole.log('Any type of data (fields, arrays, objects) can be logged’, vDate,įirst, we activated the Strict ECMA Script 5 mode.The results of our tests we displayed in the console which you can activate in the Chrome by pressing F12. We created in Eclipse an UI5 Application Project without an initial view and placed all our JavaScript code into the section of the index.html file. We used another Eclipse plugin Jetty, and the current version of the Chrome Browser which turned out to be quite convenient for our tests. We used the following tools to develop and test our examples: Eclipse Juno (JEE bundle) with UI5 v1.10 plugin installed (you will need the UI5 plugin for the very last part where we will be looking at the techniques of calling the UI5 controls). This blog is thought as a crash course and a quick reference guide to start develop immediately, sometimes by copying and pasting the sample code below. The samples below are not exhaustive, we tried to keep them rather short, and we did not demonstrate nor discuss any further alternatives which exist. Even if later you will learn the beauty of JavaScript, all you need in the beginning is a survival kit making you able to create at least something which works correctly and keeps your productivity at a reasonable degree. As every programmer coming from the other platform tries first to find analogies to the known paradigms and programming styles, the same happen to us the ABAP developers. However, the most of your time you will be developing in JavaScript, therefore knowing its basics is crucial for the beginners. The UI5 is a combination of various languages and frameworks like CSS3, jQuery, LESS, etc – just to name a few of them. This post is written by ABAP developers for the ABAP developers facing the need or just a curiosity to develop new UI5 applications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |