ionic5 white screen. Why is it not loaded tabs.ts - ionic-framework

My development environment
click here
config.xml文件内容
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
<preference name="DisallowOverscroll" value="true" />
<preference name="AllowedSchemes" value="netspay" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="ShowSplashScreen" value="true" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="Orientation" value="portrait" />
app.component.ts file part function
initializeApp() {
this.platform.ready().then(() => {
// this.statusBar.styleDefault();
this.statusBar.backgroundColorByHexString('#27507E');
setTimeout(() => {
this.splashScreen.hide();
}, 2000);
});
}
app-routing.module.ts config content
import { NgModule } from '#angular/core';
import { PreloadAllModules, RouterModule, Routes } from '#angular/router';
const routes: Routes = [
{
path: '',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
},
{
path: 'products',
loadChildren: () => import('./pages/products/products.module').then( m => m.ProductsPageModule)
},
{
path: 'proDetail',
loadChildren: () => import('./pages/proDetail/proDetail.module').then( m => m.ProDetailPageModule)
},
{
path: 'cartPage',
loadChildren: () => import('./pages/cartPage/cartPage.module').then( m => m.CartPageModule)
},
{
path: 'orderDetail',
loadChildren: () => import('./pages/orderDetail/orderDetail.module').then( m => m.OrderDetailPageModule)
},
{
path: 'payment',
loadChildren: () => import('./pages/payment/payment.module').then( m => m.PaymentPageModule)
},
{
path: 'receipt',
loadChildren: () => import('./pages/receipt/receipt.module').then( m => m.ReceiptPageModule)
},
{
path: 'setting',
loadChildren: () => import('./pages/setting/setting.module').then( m => m.SettingPageModule)
},
{
path: 'notification',
loadChildren: () => import('./pages/notification/notification.module').then( m => m.NotificationPageModule)
},
{
path: 'scanner',
loadChildren: () => import('./pages/home/scanner/scanner.module').then( m => m.ScannerPageModule)
},
];
#NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
tabs.page.ts part code
ngOnInit(): void {
console.log('page load');
}
Sometimes the screen appears white on startup. But not every time.
Page load success, display 'page load' log.
Page white screen, Does not display 'page load' log. Please tell why tabs.Page.ts file were not load!
Who can help me! thank you very much.

I once encountered this problem, this is how I fixed it:
update your platform-android version to 6.4.0
reinstall plugin cordova-plugin-webview

Related

How to remove the space between bar and legend in a sapui5 StackedBarChart

I like to create a barchart and have gotten pretty far.
My chart is a standalone view and next to some other views inside of a Shell>App>Page
View.view.xml:
<mvc:View
controllerName="my.controller.Chart"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:viz="sap.viz.ui5.controls"
xmlns:vizData="sap.viz.ui5.data"
xmlns:vizFeeds="sap.viz.ui5.controls.common.feeds"
displayBlock="true"
height="100%"
busyIndicatorDelay="0"
class="myChartView"
>
<Panel
headerText="Chart"
class="sapUiResponsiveMargin"
width="auto"
>
<viz:VizFrame
vizType="100_stacked_bar"
id="idDualStackedChart"
width="100%"
class="myStackedBarChart"
vizProperties="{plotArea: {
dataLabel:{
visible: true
},
colorPalette: ['#009c00','#ff0000'],
gridline: {
visible: false
}
},
interaction: {
noninteractiveMode: true
},
title:{ visible: false, text:'Auslastung'},
categoryAxis: {visible: false},
valueAxis: {visible: false},
legendGroup: {
layout: {
position: 'bottom',
alignment: 'center'
}
}
}"
>
<viz:dataset>
<vizData:FlattenedDataset data="{/items}">
<vizData:dimensions>
<vizData:DimensionDefinition
name="Maschine"
value="{Machine}"
/>
</vizData:dimensions>
<vizData:measures>
<vizData:MeasureDefinition
name="Stopped"
value="{Stopped}"
/>
<vizData:MeasureDefinition
name="Running"
value="{Running}"
/>
</vizData:measures>
</vizData:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<vizFeeds:FeedItem
uid="valueAxis"
type="Measure"
values="Running,Stopped"
/>
<vizFeeds:FeedItem
uid="categoryAxis"
type="Dimension"
values="Maschine"
/>
</viz:feeds>
</viz:VizFrame>
</Panel>
</mvc:View>
Chart.controller.ts
import Controller from "sap/ui/core/mvc/Controller";
import JSONModel from "sap/ui/model/json/JSONModel";
export default class ChartController extends Controller {
onInit() {
const oSampleData = new JSONModel("model/Data.json");
this.getView().setModel(oSampleData);
const chartFrame = this.byId("idDualStackedChart");
console.log(chartFrame);
}
}
Data.json
{
"items": [
{
"Machine": "Q1",
"Stopped": "20",
"Running": "40"
}
]
}
The only problem I have is: There is a lot of space above the chart and a lot of space between the chart-bar and the legend.
How can I decrease/remove this space?

How to bind array to list when array is property of the object

I have the following object:
parent = {
prop1: "asd",
prop2: "zxc",
arr: [
{
title: "qwe",
attr: {attr1: "987", attr2: "dfg"}
},
{
title: "poi",
attr: {attr1: "345", attr2: "jkl"}
}
]
}
I want to bind it to the following list:
<List id="list" items="{parent>/arr}" headerText="Example">
<items>
<ObjectListItem title="{parent>arr/title}" type="Active" press="onListItemPress">
<attributes>
<ObjectAttribute text="{parent>arr/attr/attr2}" />
</attributes>
</ObjectListItem>
</items>
</List>
I just cannot make it work.
What is the right way to show the title and the attr2 properties in this list?
try this syntax view binding below it's works :
<List id="list" items="{parent>/arr}" headerText="Example">
<items>
<ObjectListItem title="{parent>title}" type="Active" press="onListItemPress">
<attributes>
<ObjectAttribute text="{parent>attr/attr2}" />
</attributes>
</ObjectListItem>
</items>
</List>

How to bind data from controller to Xml View table

I am having a table with columns as below:
<Table id="table2" visibleRowCount="5" rows="{
path: '/ProductCollection',
sorter: {path: 'serialId', descending: false}}">
<columns>
<Column width="50px">
<m:Text text="Employee ID" />
<template>
<m:Text text="{employeeId}" wrapping="false" />
</template>
</Column>
<Column width="200px">
<m:Text text="EmployeeName" />
<template>
<m:Text text="{employeeName}" wrapping="false" />
</template>
</Column>
</columns>
</Table>
And JSON Data is :
var oData = {
ProductCollection: [
{
employeeId: "1"
employeeName:"xyz"
},
{
employeeId: "1"
employeeName:"xyz"
},
{
employeeId: "1"
employeeName:"xyz"
}
]
};
And i have tried binding as :
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(ProductCollection);
this.getView().setModel(oModel);
I am getting the data but into model but unable to display values in table getting empty rows.I am facing problem in binding(xml view)any guiding links or a solution would be much helpful , TIA
<mvc:View controllerName="reg.cmdd.Consumer.controller.Home" xmlns="sap.ui.table" xmlns:mvc="sap.ui.core.mvc" xmlns:u="sap.ui.unified"
xmlns:c="sap.ui.core" xmlns:m="sap.m" height="100%">
<m:Page showHeader="false" enableScrolling="false" class="sapUiContentPadding">
<m:content>
<Table id="table2" visibleRowCount="5" rows="{ path: '/ProductCollection', sorter: {path: 'serialId', descending: false}}">
<columns>
<Column width="50px">
<m:Text text="Employee ID"/>
<template>
<m:Text text="{employeeId}" wrapping="false"/>
</template>
</Column>
<Column width="200px">
<m:Text text="EmployeeName"/>
<template>
<m:Text text="{employeeName}" wrapping="false"/>
</template>
</Column>
</columns>
</Table>
</m:content>
</m:Page>
</mvc:View>
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("reg.cmdd.Consumer.controller.Home", {
onInit: function () {
var oData = {
ProductCollection: [{
employeeId: "1",
employeeName: "xyz"
}, {
employeeId: "1",
employeeName: "xyz"
}, {
employeeId: "1",
employeeName: "xyz"
}
]
};
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
this.getView().setModel(oModel);
}
});
});
Your code is fine, the problem must be elsewhere
EDIT:
check this line:
oModel.setData(ProductCollection);
it should be
oModel.setData(oData);

How do I achieve the same thing with sap.m.CustomListItem in JS View?

I would like to list down all the information like in the sap.m.ObjectListItem but with sap.m.CustomListItem, see the screenshot attached. How do I achieve that? any working example?
This is what I have done so far, still a long way to go:
var oListTemplate = new sap.m.CustomListItem({
content: [
new sap.m.VBox({
items: [
new sap.m.Text({
text: "{nct_id}"
}),
new sap.m.HBox({
justifyContent: "SpaceBetween",
items: [
new sap.m.Label({
textAlign: sap.ui.core.TextAlign.Left,
text: "{title}",
}).addStyleClass("Text_Big font_bold"),
new sap.m.FormattedText({
textAlign: sap.ui.core.TextAlign.Right,
htmlText: "{condition_summary}"
}),
]
}).addStyleClass("sapUiTinyMargin")
]
}).addStyleClass("sapUiTinyMargin"),
],
type: sap.m.ListType.Active,
press: function() {
alert("Clicked the list item");
}
Here is what you are looking for, hope this help you.
As #Erch suggested better to use XML view.
JS
var oListTemplate = new sap.m.CustomListItem({
content: [
new sap.m.HBox({
items: [
new sap.m.FlexBox({
items: [
new sap.m.VBox({
width: "80%",
items: [
new sap.m.ObjectIdentifier({ title: "", text: "", titleActive: "false" }),
new sap.m.Label({ text: "" }),
new sap.m.Label({ text: "" })
],
layoutData: new sap.m.FlexItemData({ growFactor: 3 })
})
new sap.m.VBox({
width: "100px",
items: [
new sap.m.Label({ text: "" }),
new sap.m.Label({ text: "" }),
new sap.m.ObjectStatus({ text: "", state: "Success" })
],
layoutData: new sap.m.FlexItemData({ growFactor: 1 })
})
],
width: "100%",
alignItems: "Start"
})
],
width: "100%",
fitContainer: "true"
}).addStyleClass("sapUiTinyMargin"),
],
type: sap.m.ListType.Active,
press: function() {
alert("Clicked the list item");
})
}
XML
<List>
<items>
<CustomListItem>
<HBox width="100%" fitContainer="true">
<FlexBox width="100%" alignItems="Start" class="sapUiTinyMargin">
<items>
<VBox width="80%">
<ObjectIdentifier title="" text="" titleActive="false" />
<Label text="" />
<Label text="" />
<layoutData>
<FlexItemData growFactor="3" />
</layoutData>
</VBox>
<VBox width="100px" class="sapUiTinyMarginBegin">
<items>
<Label text="" />
<Label text="" />
<ObjectStatus text="Product Shipped" state="Success" />
</items>
<layoutData>
<FlexItemData growFactor="1" />
</layoutData>
</VBox>
</items>
</FlexBox>
</HBox>
</CustomListItem>
</items>
</List>

Data Not Visible in Second View

I am facing one issue with data not being visible in my project.
I have created two views: Input.view.xml and plant.view.xml. In my first view, I have a button as "Material Details" and on clicking that, it moves to second view. However, it is coming blank.
My JSON file is having all the data but it's not coming in second view.
Can you please suggest what is the issue and how to fix it?
"Input View" (First View)
<mvc:View
controllerName="stock.controller.main"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns:viz="sap.viz.ui5.controls"
xmlns="sap.m">
<App id="app">
<l:VerticalLayout
class="sapUiContentPadding"
width="100%"
height="100%">
<Label
text="Product"
labelFor="productInput" />
<Input id="productInput"
placeholder="Enter Material ..."
showSuggestion="true"
showTableSuggestionValueHelp="false"
suggestionRows="{/ProductCollection}"
suggestionItemSelected="onSelectItem">
<suggestionColumns>
<Column
hAlign="Begin"
popinDisplay="Inline"
demandPopin="true">
<Label text="Name"/>
</Column>
</suggestionColumns>
<suggestionRows>
<ColumnListItem>
<Label id="inputKey" text="{ProductId} {Name}"/>
</ColumnListItem>
</suggestionRows>
</Input>
<Button id="onDisplay"
text="{i18n>materialDetails}"
press="onDisplayPlant"
class="sapUiTinyMarginEnd" />
</l:VerticalLayout>
</App>
</mvc:View>
plant.view.xml (Second View)
<mvc:View
controllerName="stock.controller.plant"
xmlns="sap.m"
xmlns:viz="sap.viz.ui5.controls"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc">
<MessagePage
showNavButton="true"
navButtonPress="onNavBack"/>
<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="End">
<Text text="Dimensions" />
</Column>
<Column
minScreenWidth="Tablet"
demandPopin="true"
hAlign="Center">
<Text text="Weight" />
</Column>
<Column hAlign="End">
<Text text="Price" />
</Column>
</columns>
<items>
<ColumnListItem>
<ObjectIdentifier
title="{Name}"
text="{ProductId}"/>
<Text text="{SupplierName}" />
<Text text="{Width} x {Depth} x {Height} {DimUnit}" />
<ObjectNumber
number="{WeightMeasure}"
unit="{WeightUnit}"
state="{
parts: [
{path: 'WeightMeasure'},
{path: 'WeightUnit'}
],
formatter: 'stock.Formatter.weightState'
}" />
<ObjectNumber
number="{
parts: [{
path: 'Price'
}, {
path: 'CurrencyCode'
}],
type: 'sap.ui.model.type.Currency',
formatOptions: {
showMeasure: false
}
}"
unit="{CurrencyCode}" />
</ColumnListItem>
</items>
</Table>
</MessagePage>
</mvc:View>
plant.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller",
"jquery.sap.global",
"stock/Formatter",
"sap/ui/core/routing/History",
"sap/ui/model/json/JSONModel"
], function (Controller, jQuery, Formatter, History,JSONModel) {
"use strict";
var TableController = Controller.extend("stock.controller.plant", {
onInit: function () {
var oModel = new JSONModel(jQuery.sap.getModulePath("sap.ui.demo.mock", "/products.json"));
this.getView().setModel(oModel);
},
getRouter : function () {
return sap.ui.core.UIComponent.getRouterFor(this);
},
onNavBack: function () {
var oHistory = History.getInstance();
var sPreviousHash = oHistory.getPreviousHash();
if (sPreviousHash !== undefined) {
window.history.go(-1);
} else {
this.getRouter().navTo("input", {}, true);
}
}
});
return TableController;
});
Component.js
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/core/mvc/XMLView",
"sap/ui/model/json/JSONModel"
], function(UIComponent, JSONModel, XMLView) {
"use strict";
var Component = UIComponent.extend("stock.Component", {
metadata: {
manifest: "json",
getTable: function () {
return this._rootView.getContent()[0];
}
},
publicMethods: [
"getTable"
],
dependencies: {
libs: [
"sap.m",
"sap.ui.layout"
]
},
rootView: "stock.view.input",
config: {
sample: {
files: [
"view.input.view.xml",
"controller.main.controller.js",
"Formatter.js"
],
description : "In this example assisted input is provided with table-like suggestions where several columns can display more details."
}
},
init : function () {
UIComponent.prototype.init.apply(this, arguments);
this.getRouter().initialize();
}
});
Component.prototype.createContent = function () {
this._rootView = sap.ui.xmlview({ viewName : "stock.view.plant" });
return this._rootView;
};
return Component;
});