cancel
Showing results for 
Search instead for 
Did you mean: 

Jquery with SAP Panel

Former Member
0 Kudos

Hi Guys,

I have a Element like below pertaining to SAP UI5 Panel with a Panel Title as Station 70

<h5 id="ssLST70-title" class="sapUiPanelHdrItem sapUiPanelTitle sapUiTvH5" role="heading">Station 70</h5>

I want to access Station 70 value via Jquery :

alert($("#ssLST70-title").text() );

The result is UNDEFINED. How do i get value Station 70

?

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Asif,

It should be -


Using jQuery - $('#ssLST70-title')[0].innerHTML;

Using SAPUI5 - sap.ui.getCore().byId("ssLST70").getTitle().getText()

Sample using jQuery: JS Bin - Collaborative JavaScript Debugging

Regards,

Sai Vellanki.

Former Member
0 Kudos

Sai

Thanks, I will try this.

How do i Set the Title of Panel as below is not working :

sap.ui.getCore().byId("ssLST70").setTitle = "Station 70";


+


How do I access Style Sheet applied to Panel TITLE ?


Asif

SergioG_TX
Active Contributor
0 Kudos

sap.ui.getCore().byId("ssLST70").setTitle("Station 70"); use parenthesis for set and get

saivellanki
Active Contributor
0 Kudos

Asif,

To get the style class, try like below -


var oPanelTitle = $('#ssLST70-title')[0];

oPanelTitle.getAttribute("class");

Regards,

Sai Vellanki.

Former Member
0 Kudos

Sai

Thanks but the code is slightly different hence it above will not work.

See the image attached at the place where I am pointing, I want to get "GREENPANEL" in class.

saivellanki
Active Contributor
0 Kudos

Method will remain same, only the id changes.


var oPanel = $('#L3ST70')[0];

oPanel.getAttribute("class");

Regards,

Sai Vellanki.

SergioG_TX
Active Contributor
0 Kudos

A

SergioG_TX
Active Contributor
0 Kudos

A

SergioG_TX
Active Contributor
0 Kudos

Asif, I recommend you use the sapui5 functions as the generated id is dynamically assigned and it doesnt guarantee in the future it will follow the same pattern - please check out the sdk api reference for your questions regarding the different functions, methods, events, properties, etc https://sapui5.netweaver.ondemand.com/#docs/api/symbols/sap.ui.html

Former Member
0 Kudos

Sai

It is saying cannot READ property GetAttribute

I think the method is not picked.

i think it is like this :

$('#L3ST70').attr("class")

?

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

Asif, do you have the correct id that is rendered on the html side? if you use the developer tools, get the correct id that gets rendered on the HTML tag. the id rendered is different than the id that you gave it when created the object. once you have that you can use the jquery code above. also try .val() in case you need the value. you can also use the standard js function from sapui5 to get the title.. on the controller.. this.getById('IdOfYourObject').getTitle() hope this helps

Former Member
0 Kudos

Sergio

I tried the below statement to setTitle as the ID of the object is ssLST70 :

sap.ui.getCore().byId("ssLST70").setTitle = "Station 70";

why is this not working ?

plus how do i access the name of style sheet applied to Panel ?

Any source code available for reference would help.

Thanks

saivellanki
Active Contributor
0 Kudos

sap.ui.getCore().byId("ssLST70").getTitle().setText("Station 70");

Regards,

Sai Vellanki.