on 02-21-2017 8:53 PM
Hello everyone, I hope you can help me, I'm reviewing the best practices guide on sapui5, And I'm modifying a project that I already had, it runs perfectly, But when working with routing as best practices recommend, the links in my controls do not work, I think it is a config issue of the manifest.json, but I have not found the solution. Somebody could help me with an example configuration of the json.manson json model, what I currently do is:
in the view, I instantiate a json model, an extension of sap.ui.model.json.JSONModel and assign it to the core,
Then binding my table with "/ data"
var oModel = new myJSONModel; Sap.ui.getCore (). SetModel (oModel);
oTable.bindItems ("/data", new sap.m.ColumnListItem ({
cells: [ New sap.m.Text (). BindProperty ("text", "material"),
new sap.m.Text (). BindProperty ("text", "quantity"),
new sap.m.Text (). BindProperty ("text", "date"),
new sap.m.Text (). BindProperty ("text", "center"),
new sap.m.Text (). BindProperty ("text", "store"),
new sap.m.Text (). BindProperty ("text", "msg"), ] }) );
Then in the controller I call a service.
oModel2.loadDataJSONP ("http: //hostt: 8000 / sap / bc / zserve_solpejp? Sap-client = 800 /", handleSuccess, handleError, oParameters, true, 'GET', false, false , "CallBack");
function handleSuccess (oData) {
oData2 = oModel2.getData ();
var oData = sap.ui.getCore (). GetModel (). GetData ();
oData.data = jQuery.merge ([], oData2.data);
sap.ui.getCore (). GetModel (). SetData (oData, false);
defaultLightBusyDialog.close ();
}
and I do not get any error per console.
Just a guess....
When you are not using 'manifest.json' it implies that you are not using 'Component.js' and model is set at 'sap.ui.core' which can be accessed from any view.
While using 'manifest.json'...then 'Component.js' becomes mandatory and all models are to be set at 'Component' level so that it can be accessed by the views. In this case any models set at 'sap.ui.core' will not be accessible.
Try setting the model in 'Component.js' init method and see if it works or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
srikanth.kv4 Could you help me with this please? , I've been days without the solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The data is not shown in the table, but by testing I can see that the data if passed to var oData = sap.ui.getCore (). GetModel (). GetData ();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please post what you have in manifest.json?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this case I should work with json model, not with odata model, why when I work without the manifest.json my application works normally, but when I use the manifest.son for the routing the binding no longer works?
Es obligatorio configurar el manifiesto.json para usar json model en la aplicación?
Please give me a hand.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you check IWFND/ERROR_LOG tcode in the backend? Also, the best way to bind a table in UI5 is the use binding in an XML view. The reason for this is performance, as it only calls for data when the table is initialized.
For example:
<Table id="idProductsTable"
inset="false"
items="{
path: '/ProductCollection',
sorter: {
path: 'Name'
}
}">
<headerToolbar>
<Toolbar>
<Title text="Products" level="H2"/>
</Toolbar>
</headerToolbar>
<columns>
<Column
width="12em">
<Text text="Product" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true">
<Text text="Supplier" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true"
hAlign="Right">
<Text text="Dimensions" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true"
hAlign="Center">
<Text text="Weight" />
</Column>
<Column
hAlign="Right">
<Text text="Price" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectIdentifier
title="{Name}"
text="{ProductId}"/>
<Text
text="{SupplierName}" />
<Text
text="{Width} x {Depth} x {Height} {DimUnit}" />
<ObjectNumber
number="{WeightMeasure}"
unit="{WeightUnit}"
state="{
path: 'WeightMeasure',
formatter: 'sap.m.sample.Table.Formatter.weightState'
}" />
<ObjectNumber
number="{
parts:[{path:'Price'},{path:'CurrencyCode'}],
type: 'sap.ui.model.type.Currency',
formatOptions: {showMeasure: false}
}"
unit="{CurrencyCode}" />
</cells>
</ColumnListItem>
</items>
</Table>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.