cancel
Showing results for 
Search instead for 
Did you mean: 

How to display values of MBO attribute on Button/Menu Item in HWC app

Former Member
0 Kudos

Hi All,

How to display the value of MBO attribute on Button or Menu Item in HWC app.

This is just like displaying Notification on button/Menu item.

Help will be really appreciated.

Regards

saket

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Saket,

I am not sure what approach you are using either hybrid web designer or hybrid API apporach.

chck this

http://scn.sap.com/community/developer-center/mobility-platform/blog/2013/07/18/hwc-application-deve...

Rgrds,

Jitendra

Former Member
0 Kudos

Thanks Jitendra for replying, I am developing HWC app with hybrid Web Designer.

I actually want to display the value of MBO attributes on Button.

Is it possible to display the value of MBO attribute directly on button/menu item.

Regards

Saket

Former Member
0 Kudos

Tahir can you help me in this.

Tahir Öz

Regards

Saket

tahir_z
Contributor
0 Kudos

Hi Saket,

Do you want to change name of a jquerymobile button or name of a menuitem ?

Regards

Tahir

Former Member
0 Kudos

Tahir,

I want to change the label of button or menu item whichever works.

I tried many things but still no luck.

Regards

Saket

tahir_z
Contributor
0 Kudos

For menuitem;

Once you create menuitem in designer it creates a html tag called "sup_menuitems" in jquerymobilelookandfeel.html file. So go to the html file and try find the sup_menuitems tag for corresponding screen div for example;

login screen for my case

<div data-role="page" data-theme='a' id="LoginScreenDiv" sup_screen_title="Login" style="" sup_menuitems="Back,Back,Login,Login,Logout,Logout" sup_okaction="doSaveActionWithoutReturn()"> 

In above if you change name of the first item of a action it will change menuitem name,

<div data-role="page" data-theme='a' id="LoginScreenDiv" sup_screen_title="Login" style="" sup_menuitems="<Nameofbutton>,Back,<Nameofbutton>,Login,<Nameofbutton>,Logout" sup_okaction="doSaveActionWithoutReturn()">

Once you deploy application uncheck the generate files if you dont do this it will re-generate html

Hope this helps

Regards

Tahir

Former Member
0 Kudos

Thanks Tahir,

Actually i want to display the MBO value on Button or menu item.

Regards

Saket

tahir_z
Contributor
0 Kudos

Are you able to get MBO value ? if yes, then you can assign the value with javascript to the html tag as i explained above.

Above code changes Menuitem name.

Changing jquery mobile button with javascript as below,

$('#<yourscreenname>ScreenDiv .ui-btn-text').text("<MBOvalue>");

Regards

Tahir

Former Member
0 Kudos

Hey Tahir,

You are a life saver....it works.

Now, i have one question:

the below code is working for me, now if i have four buttons so how should i mapped other field values of MBO to other buttons.

if(destScreenKey=="Count")

                    {

                    var message = getCurrentMessageValueCollection();

               var itemList = message.getData("MBOName");// MBO name

               var items = itemList.getValue();

               var currItem= items[0];

                var MBOVal = currItem.getData("ArkanPendingcount_FieldOne").getValue();

                alert(MBOVal);

                    $('#CountScreenDiv .ui-btn-text').text(MBOVal);

                    }

eg:

I have One MBO = with four fields: F1, F2, F3, F4.

And on screen i have four buttons: b1, b2, b3, b4.

I the code suggested by you there we didnot mentioned button name, so how to set f1 on b1 and so on....

Your help always a life saver.

Regards

Saket

Message was edited by: saket amraotkar

tahir_z
Contributor
0 Kudos

Hi Saket,

I just wrote the below code but didnt tried there might some syntax errors but logic is as you need.

var message = getCurrentMessageValueCollection();

var itemlist = message.getData("MBOName");

for(var i = 0; i < itemlist.value.length;i++){

   var F1  = itemlist.value[i].getData("FieldOne");

   var F2  = itemlist.value[i].getData("Fieldtwo");

   var F3  = itemlist.value[i].getData("Fieldthree");

   var F4  = itemlist.value[i].getData("Fieldfour");

   $("span > span", $("#<FirstBtnID>").parent()).html("F1.value");

   $("span > span", $("#<SecondBtnID>").parent()).html("F2.value");

   $("span > span", $("#<ThreeBtnID>").parent()).html("F3.value");

   $("span > span", $("#<FourBtnID>").parent()).html("F4.value");

}

Hope this helps

Regards

Tahir

Message was edited by: Tahir Öz

Answers (0)