Apply CSS on a Table Cell Based on Content in SAPUI5

SAP Developer
Updated on 12-Jun-2020 12:08:05

974 Views

You are having one of the most common requirements in the case of the table. You can achieve the end result using formatter function exposed on the cells of a table.Here is a code snippet for your reference which you can alter as per your use case:cells: [    new sap.m.Text({       text: {          formatter: function(name) {             if (name == "") {                // you can add style class or do your own logic here                this.addStyleClass("Total");             }          }       }    }) ]

Commit Changes on SAP BAPI Transaction

SAP Developer
Updated on 12-Jun-2020 12:05:35

687 Views

You are correct that in order for the changes done by BAPI to come into effect, you need to call the commit function.It will commit all the changes which are uncommitted not only the last transaction. You can refer below link to know more about BAPI_TRANSACTION_COMMIT and COMMIT WORK:BAPI_TRANSACTION_COMMIT

Get First Day of the Week Using Python

Rajendra Dharmkar
Updated on 12-Jun-2020 11:54:08

2K+ Views

You can use the calender module to get the first day of the week using Python. The calender module has a special function, firstweekday(), that returns the current setting for the weekday to start each week.Exampleimport calendar print(calendar.firstweekday()) calendar.setfirstweekday(2) print(calendar.firstweekday())OutputThis will give the output −6 2

Print Python Datetime in Local Timezone

Rajendra Dharmkar
Updated on 12-Jun-2020 11:50:58

2K+ Views

The easiest way in Python date and time to handle timezones is to use the pytz and tzlocal modules. These libraries allows accurate and cross platform timezone calculations. pytz brings the Olson tz database into Python. It also solves the issue of ambiguous times at the end of daylight saving time, which you can read more about in the Python Library Reference (datetime.tzinfo).Before you use it you'll need to install it using −$ pip install pytz tzlocalExampleYou can use the pytz library as follows −from datetime import datetime from pytz import timezone from tzlocal import get_localzone format = "%Y-%m-%d %H:%M:%S ... Read More

Get Computer's UTC Offset in Python

Rajendra Dharmkar
Updated on 12-Jun-2020 11:47:41

2K+ Views

The computer's UTC offset is the timezone set on your computer. YOu can get this timezone information using the time module. time.timezone returns UTC offset in seconds.For exampleimport time print(-time.timezone) # India's timezone: +5:30OutputThis will give the output −19800You can also use other workarounds to get the timezone information. You can create datetime objects for UTC and local timezones and subtract them and finally get the difference to find the timezone.For exampleimport time from datetime import datetime ts = time.time() utc_offset = (datetime.fromtimestamp(ts) -               datetime.utcfromtimestamp(ts)).total_seconds()OutputThis will give the output −19800Read More

Striped Table with Bootstrap

George John
Updated on 12-Jun-2020 11:44:21

442 Views

To add a striped table in Bootstrap, use the .table-striped class. You can try to run the following code to implement the .table-striped class −ExampleLive Demo           Bootstrap Table                                                Footballer Rank                                      Footballer                Rank                                                            Amit                3                                        Kevin                2                                

Change No Data Text for Search in SAPUI5

SAP Developer
Updated on 12-Jun-2020 11:42:15

621 Views

You just need to use the noDataText property to sort out your requirement.You have two options, either you can change in controller or you can change in the XML.Option 1:Call the setNoDataText method in the init methodthis.byId(“”).setNoDataText(“”)Option 2:Add the noDataText property in the XML

Inline Subheadings in Bootstrap

Ankith Reddy
Updated on 12-Jun-2020 11:34:35

970 Views

To add an inline subheading to any of the headings, simply add around any of the elements or add .small class and you will get a smaller text in a lighter color. You can try to run the following code to work with inline subheadings in Bootstrap −Example Live Demo           Bootstrap Example                                       Heading1 h1.          I'm secondary Heading h1             Heading2 h2.          I'm secondary Heading h2          

Function Expression vs Function Declaration in JavaScript

Rishi Raj
Updated on 12-Jun-2020 11:30:56

412 Views

Function DeclarationThe “function” keyword declares a function in JavaScript. To define a function in JavaScript use the “function” keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces.Here’s an example −function sayHello(name, age) {    document.write (name + " is " + age + " years old."); }Function ExpressionFunction Expression should not start with the keyword “function”. Functions defined can be named or anonymous.Here are the examples −//anonymous function expression var a = function() {    return 5; }Or//named function expression var a = function bar() {    return 5; }

Parse JSON Object in JavaScript

Vikyath Ram
Updated on 12-Jun-2020 11:28:10

694 Views

ExampleTo parse JSON object in JavaScript, implement the following code −                    myData = JSON.parse('{"event1":{"title":"Employment period","start":"12\/29\/2011 10:20 ","end":"12\/15\/2013 00:00 "},"event2":{"title":"Employment period","start":"12\/14\/2011 10:20 ","end":"12\/18\/2013 00:00 "}}')          myArray = []          for(var e in myData){             var dataCopy = myData[e]             for(key in dataCopy){                if(key == "start" || key == "end"){                   dataCopy[key] = new Date(dataCopy[key])                }             }             myArray.push(dataCopy)          }          document.write(JSON.stringify(myArray));          

Advertisements