IBM Worklight 6.0 - WL.TabBar.addItem title parameter not working correctly with "null" as value

209 views Asked by At

According to the documentation for WL.TabBar.addItem regarding the title parameter:

WL.TabBar.addItem(id, callback, title, options);

title   Mandatory string. The title of the tab. If null is passed, no title is displayed.

However, if I pass the value null like this:

WL.TabBar.addItem("myId", function(){ ... }, null, { ... }); 

I get this error:

Invalid invocation of method WL.TabBar.addItem; Invalid value 'null' (object), expected type 'string'.

And if I pass an empty string " ", I don't see the title but there's empty spacing at the bottom, below the icon.

1

There are 1 answers

14
Idan Adar On BEST ANSWER

Well, it's clearly a bug... :)
I have opened a defect. Thanks!

If what you want to do is to center-align the icon in the tab when there is no text involved, then adding the following to your Android environment's .css file will suffice:

.tabSpan {
   background-position:center; 
}

In addition, and if required, you can also play with the icon dimensions.