Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all 6178 articles
Browse latest View live

view setModel Issue

$
0
0

Hello,

 

I am trying to set a json model to a view it all works fine, except when one of the objects have an attribute (string) with a "{" that is not being closed.

The error happens when the "core" try to execute the line "propagateProperties".

 

*if the string contains "{}" it works fine

 

any suggestion on how to solve this, or do I have to create a ticket to UI5team?

 

thanks. Cristiano.

 

Capture.PNG


SAPUI5 support for Eclipse

$
0
0

I've two questions:

 

1. Is Eclipse supported for SAPUI5 development by SAP in future?

 

2. We are working with SAPUI5 version 1.28. Is it supported in WebIDE and can i simply choose on which version to run the project?

 

Thanks,

Peter

OPENUI5 on non ABAP server

$
0
0

Hi ,

 

what are the server side  possibilities to work with OPENUI5  ?

 

Can i deploy it to any application server ?

 

Thanks,

Arie.

SplitApp - how to get record selected

$
0
0

Hi

 

I am following some tutorials and am trying to create a sample splitapp application and am able to load records in master view. Now in Master controller I am trying to select the whole record, I am able to get spath or indivdual value like order/description but not to the complete record. It comes as null (var item below)

 

 

var oSelect = oEvent. getParameter("listItem");

 

  var context1 = oSelect.getBindingContext();

 

  var sp = context1.sPath;

  

  var orId = context1.getProperty("order");

  

  var item = sap.ui.getCore().getModel().getProperty(orId);

 

  console.log(context1,sp,orId,item);

  }

 


My json model is there in Master controller INIT method.


onInit: function() {

 

  var oModel = new sap.ui.model.json.JSONModel("model/mock.json");

  sap.ui.getCore().setModel(oModel);

 

  },

1.PNG

1.PNG

 

Please help and let me know how to reach complete record.

 

Thanks

Justin

Cannot delete line from table with delete button

$
0
0

Hello Experts,

 

I have created a table with delete functionality as per the type delete of table as below.2016-04-18_10-23-12.jpg

Unfortunately the delete functionality is not working on clicking the delete button, below is the code I have written in JS base on information I got online.

2016-04-18_10-12-00.jpg

I am not able to get value in variable oRowData from the method oModel.getData because of which it is not recognize the splice method.

I have searched some site and was able to get this code implementation only to delete row, also I observed the table was created using Java Script as per code online but in my case I have created through layout editor in XML, is the the problem here?

 

Request you help here..

Will reward accordingly.

How to fetch logged in user details in sapui5 cloud application

$
0
0

Hi,

 

I need to pass UserId of logged in user in a request. Can anybody please suggest how to get logged in user details in sapui5 cloud based application.

 

Thanks and Regards,

Nikhil

Uncaught TypeError: Cannot read property 'metadataLoaded' of undefined

$
0
0

I'm developing my first UI5 app using the Worklist template and attempting to deploy it but I'm getting a error when running it from the Fiori Launchpad. However, it works fine from the WebIDE.

 

When clicking the tile, it's launching the app but I'm getting a blank page.

 

cloud.png

Pressing F12 in Chrome shows me the following error:

"Uncaught TypeError: Cannot read property 'metadataLoaded' of undefined"

 

cloud2.png

I've google'd this message but nothing conclusive comes up.

 

Any ideas?

How to get all registered models during run time?

$
0
0

Hello,

 

Is there a way to get all the registered models during run time?


How to rebuild companion app with custom SAPUI5?

$
0
0

Hi,

 

I have installed HAT and it build a companion app successfully.

I want now to use a custom SAPUI5 library, which I already put in the SAPHybrid folder.

How do I restart the companion build to include this custom SAPUI5 library?

 

Regards,

Wolfgang

Aggregation binding content display problem in Dialog

$
0
0

Hi Experts,

 

My requirement is as shown below,

 

dialog.png

I am trying this way but text beside the radio button is not being displayed,

 

  I am using below code:

 

  var dialog = new Dialog({

  title: "Available Timings",

  contentWidth: "550px",

  contentHeight: "300px",

  content: new sap.m.RadioButton({

  items: {

  path: "/timings",

  template:

  new StandardListItem({

  title: "{slot1}"

  })

  }

  })

  });

 

Data file:

{

  "timings": [{

  "slot1": "11:30 AM to 12:30 PM",

  "slot2": "02:30 PM TO 03:30 PM"

 

  }, {

  "slot1": "10:30 AM to 12:30 PM",

  "slot2": "03:30 PM TO 05:30 PM"

  }]

}

 

Output :

 

dialog2.png

If I use List in place of RadioButton (as shown below), only List data appears but without radio button. I need both to  be displayed.

 

 

var dialog = new Dialog({

  title: "Available Timings",

  contentWidth: "550px",

  contentHeight: "300px",

  content: new List({

  items: {

  path: "/timings",

  template:

  new StandardListItem({

  title: "{slot1}"

  })

  }

  })

  });

 

 

Please correct me.

MutliToggle mode of sap.ui.table.Table is not working as same as in Explored

$
0
0

Hi Experts,

 

I would like to implement a sap.ui.Table, as shown here in the SAPUI5 Explored. As can be seen in the Explored page, this table allows for multi-selection of items with a checkbox on the left side. However, I am not able to implement the same. The visual style of the Table is different from the one in Explored (the checkboxes in the left side of the Table are missing).


Does this needs some other stylesheet?

Can someone help me on getting the exact same style as the one shown in the Explored example?


Thanks in advance!


Regards,

Sharique

Unable to map oData results to simple form fields

$
0
0

Hello Experts,

 

I am trying to map oData output to simple form fields. For this, I have defined the oData model in manifest.json as follows.

 

"dataSources": {

 

  "employeesDS": {

 

  "uri": "/sap/opu/odata/sap/ZFAH_GW_CRUDQ_USERS_1_SRV/",

 

  "type": "OData",

 

  "settings": {

 

  "annotations": [],

 

  "odataVersion": "2.0",

 

  "localUri": ""

  }

  }

  }

....

 

"models": {

 

  "i18n": {

...

  },

 

  "myOModel": {

 

  "dataSource": "employeesDS",

 

  "settings": {

 

  "defaultBindingMode": "TwoWay"

  }

  }

 

The JSON output of /sap/opu/odata/SAP/ZFAH_GW_CRUDQ_USERS_1_SRV/EmployeeSet('1000000002') is as follows

{

   "d" : {

...

    },

     "Empid" : "1000000002",

     "Empname" : "Rehna",

     "Empadd" : "B",

     "Empdesc" : "B"

   }

}

 

View binding is done as follows:

 

<Label text="Employee ID" id="EmapID_label"/>

<Input width="100%" id="EmpID_input" value="{myOModel>/Empid}"/>

<Label text="Name" id="Name_label"/>

<Input width="100%" id="Name_input" value="{myOModel>/Empname}"/>

 

I have invoked it from Component.js (during form load for testing purpose) as follows:

init: function() {

...

var oModel = this.getModel("myOModel");

var oMetadata = oModel.getServiceMetadata();

console.log(oMetadata);

oModel.attachMetadataLoaded(null, function(){

var oMetadata = oModel.getServiceMetadata();

console.log("oMetadata loaded successfully:"+oMetadata); },

null);

oModel.read("/EmployeeSet('1000000001')", { 

  success: function(oData, response){

  MessageToast.show("Success");

  this.setModel(oData,"myOModel");

  alert("success by oModel.read event handler");

}

 

Here, console.log(oMetadata) is showing some results which indicates the oData service call is successful.

However, I am getting error in the following line of success event handler

this.setModel(oData,"myOModel");

Error message in chrome log says: Cannot read property 'setModel' of undefined.

By writing this.setModel(oData,"myOModel"), I was trying to set the result retrieved from oData back to the Component.js model so that view fields will display the corresponding values (from myOModel). However, I am wondering how "this" can be undefined!!

 

Please note that I am trying this with latest WebIDE. Can you please let me know what I am doing wrong here? Also, is this the right approach to invoke and bind oData model to view fields?

 

Thanks,

Faddy

How to pass table data from one controller to other in UI5?

$
0
0

I am able to load data in my first view from an external JSON file. In my view1 controller I modify the JSON data and showing it in the table.

Now, I want to show this table data in my view2. How can I do that as my JSON is extenal file and the new data added to it through the program is not reflecting in the file.

How can i achieve my requirement? What are the possible ways to do it?

Access Component object without ID

$
0
0

I am doing this in my index.html

 

 

<script>
 sap.ui.getCore().attachInit(function () {
 new sap.m.Shell({
 app: new sap.ui.core.ComponentContainer({
 name: "sap.ui.demo.wt"
 })
 }).placeAt("content");
 });</script>

SAPUI5 Explored

 

I want to get the Component ID to setModel or getModel from my controller, how can I access the component ID?

 

I want to get the Component ID to set to this call sap.ui.component(<sComponentId>)

Problem with rendering of sap.m.RatingIndicator after deployment in on-premise system

$
0
0

Hello,

 

i'm developing an application one view of which contains a table with sap.m.RatingIndicator almost in each column. it looks nice in SAP Web IDE (see image001.png) but after deployment looks ugly (see image002.png). what could be wrong? our backend system has version 1.28.31 (7.40 SP15). i've selected the same version in Web IDE for Run with Server and it looks fine.

 

My XML view part is below

  <items>  <ColumnListItem>  <cells>  <ObjectIdentifier title="{EmpName}" text="{Company}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question1', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question1txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question2', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question2txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question3', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question3txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question4', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question4txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question5', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question5txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question6', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question6txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question7', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question7txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question8', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question8txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question9', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question9txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Question10', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Question10txt}"/>  <RatingIndicator iconSize="1rem" maxValue="3" value="{path: 'Duration', formatter: '.formatter.string2number'}" class="sapUiSmallMarginBottom" enabled="false" tooltip="{Durationtxt}"/>  </cells>  </ColumnListItem>  </items>

thanks for any suggestions


Convert json into odata?

$
0
0

Hi All,

I am creating a custom fiori application in WEBIDE by consuming the oData service exposed from gateway system.

In one of the update screen development, i have a requirement to add/delete rows (PFA), so to do that i have converted my odata model into json and added the logic to add/delete rows which is working fine.

 

Now, i have to make a batch request to update whatever changes i have made on the screen to my backend system. So, the question is how can i convert my updated json model back into odata?

 

Code used to get json model is -

 

var model = new sap.ui.model.json.JSONModel();

var sURL = "/sap/opu/odata/sap/zproject_srv_05"+ oData.objectPath+ "?$expand=nav_headertoitem&$format=json";

$.ajax({

url: sURL,

dataType: "json",

success: function(response) {

var data = response;

model.setData({nav_headertoitem: response.d.nav_headertoitem.results});

}

});

this.getView().byId("Table").setModel(model);

 

 

 

 

 

Add functionality-

addArticle.PNG

 

Delete - Two items are deleted, post hitting delete button.

 

delete.PNG

 

Thanks

Amit Srivastava

 

 

How to Add/Delete row of a table manually on a button click in xml view?

$
0
0

Hello,

 

I am designing a screen in which a table is displayed. Initially table is populated by a json file. Screen has two buttons, one to insert a row into the table and other is to delete a row. After any of the two events, updated table is displayed on the screen. My code:

 

 

IN View

 

<Table

  id="idTable" width="100%"

  items="{

        path: '/Team'

              }">

 

In Controller:

 

1. For adding

 

var oModel = sap.ui.getCore().byId("idTable").getModel();  

var aEntries = oModel.getData().Team;

var field1 = sap.ui.getCore().byId("idField1").getValue();                          //getting data from user

var field2 = sap.ui.getCore().byId("idField2").getSelectedItem().getText();  //getting data from user

var oEntry = {

  Id: aEntries.length + 1,

  Name: field1 ,

  Role: field2 ,

  BU: "ETRX",

  };

 

 

  aEntries.unshift(oEntry);

  oModel.setData({

  Team: aEntries

  });

 

2. For deleting

 

var oModel = sap.ui.getCore().byId("idTable").getModel();

var aEntries = oModel.getData().Team;

var objToDelet = oModel.getObject(evnt.getSource().getParent().getBindingContext().getPath());

aEntries.shift(objToDelet);

oModel.setData({Team : aEntries});

 

I am getting this error :

 

Uncaught TypeError: Cannot read property 'getModel' of undefined

 

 

Please help.

 

Thank You,

 

Test driven development with UI5

$
0
0

Hi everybody,

 

first thing: I'm new to SAP UI5. I'm used to develop mit Angular, jQuery or plain JavaScript. In those cases, I have a good feeling about how and when to write tests and to develop my applications test-driven.


I'm wondering what would be the best way to apply test-driven-development in UI5 applications. I wrote some QUnit-Tests, read all the articles I good find (maybe I missed some good ones?) and I'm struggling with getting a good feeling to cover my code with tests. I'm pretty sure, that I don't have to cover everything line of code I write, since there is a lot of UI5-framework-magic going on, which I trust and don't want to test.

 

What exactly will I test? I found some answers here: QUnit Testing for SAPUI5 Controls - UI Development Toolkit for HTML5 (SAPUI5) - SAP Library

I'm thinking about testing my views (like which elements i expect to be on the page, which state a control could have, etc.), my controllers and my routing. Do you think this is a good idea?

 

While developing I would start with tests that check for the presence of the Controls my customer would expect. Afterwards I would add tests for the expected behaviour, handling of different data-structures and later on test the switching of views.

 

I'd love to hear about your ideas, approaches or workflows while developing test driven in UI5.

 

Best Regards,

Peter

How to update sapui5 development toolkit?

$
0
0

Hi all,

 

I need to use the 1.36.7 version UI Development Toolkit for HTML5 Eclipse Tools, I already found it in SAP Note 2301129.

 

However, I don't know how to use it. My current toolkit version is 1.34, which is the latest I can get from Eclipse.

 

Can anyone tell me how can I upgrade to 1.36.7??

 

Thanks in advance,

Natalie.

How to change cordova android .apk icon

$
0
0

Hi sir/madam,

 

I have done android app using sapui5 and cordova but i dont know how to change this .apk icon please anyone can help me

 

 

thank you

 

 

Regards,

Manjunath M M

Viewing all 6178 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>