1

sap.ui.getCore().byId and sap.ui.getCore().byId not getting the element.

 2 years ago
source link: https://answers.sap.com/questions/13711125/sapuigetcorebyid-and-sapuigetcorebyid-not-getting.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
8 minutes ago

sap.ui.getCore().byId and sap.ui.getCore().byId not getting the element.

7 Views

Hi Experts,

From my main controller the sap.ui.getCore().byId works without a problem but I have a new page with IconTabFilter the show the information and can edit the data.

here is my view claim.view.xml

<mvc:View controllerName="com.tmclaimsz_tm_claims.controller.claim.Claim" xmlns:t="sap.ui.table" xmlns:mvc="sap.ui.core.mvc"
	xmlns:u="sap.ui.unified" xmlns:c="sap.ui.core" xmlns="sap.m" height="100%" displayBlock="true">
	<App>
		<Page id="claimsDetailsPage" title="{i18n>claimsTitle} - {/0/ClaimId}">
			<content>
				<IconTabBar id="iconTabBar" headerBackgroundDesign="Transparent" class="sapUiResponsiveContentPadding" expandable="false">
					<items>
						<IconTabFilter id="infoTab" text="Info" key="Info">
							<VBox visible="{=!${editModel>/state}}">
								<mvc:XMLView viewName="com.tmclaimsz_tm_claims.view.claim.ClaimInfoDisplay"></mvc:XMLView>
							</VBox>
							<VBox visible="{editModel>/state}">
								<mvc:XMLView viewName="com.tmclaimsz_tm_claims.view.claim.ClaimInfoChange"></mvc:XMLView>
							</VBox>
						</IconTabFilter>
						<IconTabFilter id="paymentTab" text="Payment" key="Payment">
							<VBox visible="{=!${editModel>/state}}">
								<mvc:XMLView viewName="com.tmclaimsz_tm_claims.view.claim.ClaimPaymentDisplay"></mvc:XMLView>
							</VBox>
							<VBox visible="{editModel>/state}">
								<mvc:XMLView viewName="com.tmclaimsz_tm_claims.view.claim.ClaimPaymentChange"></mvc:XMLView>
							</VBox>
						</IconTabFilter>
					</items>
				</IconTabBar>
			</content>
			<footer>
				<Toolbar>
					<ToolbarSpacer/>
					<Button visible="{=!${editModel>/state}}" text="Approve"/>
					<ToolbarSeparator visible="{=!${editModel>/state}}"/>]	
					<Button visible="{=!${editModel>/state}}" text="Edit" press="onPressEdit"/>
					<ToolbarSeparator visible="{=!${editModel>/state}}"/>
					<Button visible="{editModel>/state}" text="Cancel" press="onPressCancel"/>
					<ToolbarSeparator visible="{editModel>/state}"/>
					<Button visible="{editModel>/state}" text="Save" press="onPressSave"/>
				</Toolbar>
			</footer>
		</Page>
	</App>
</mvc:View>

Here is the connected view for InfoTab that I want to get the value of each input selecting byId but it's not working..

ClaimInfoDisplay.xml.view

<mvc:View controllerName="com.tmclaimsz_tm_claims.controller.claim.Claim" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core"
	xmlns:t="sap.ui.table">
	<l:Grid defaultSpan="L12 M12 S12">
		<VBox>
			<f:Form id="DetailsOfClaims" editable="false">
				<f:title>
					<core:Title text="Details Of Claims"/>
				</f:title>
				<f:layout>
					<f:ResponsiveGridLayout labelSpanXL="2" labelSpanL="2" labelSpanM="2" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4"
						emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false"/>
				</f:layout>
				<f:formContainers>
					<f:FormContainer>
						<f:formElements>
							<f:FormElement label="Claim ID">
								<f:fields>
									<Text text="{/0/ClaimId}" id="sClaimIdText"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
							<f:FormElement label="Status">
								<f:fields>
									<Text text="{/0/ClaimStatus}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
							<f:FormElement label="Carrier ID">
								<f:fields>
									<Text text="{/0/CarrierId}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
							<f:FormElement label="Tor ID">
								<f:fields>
									<Text text="{/0/TorId}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
					
						<f:formElements>
							<f:FormElement label="Delivery Date">
								<f:fields>
									<Text text="{/0/DeliveryDate}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
								<f:FormElement label="Total Amount">
								<f:fields>
									<Text text="{/0/TotalAmountInt}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
					</f:FormContainer>
				</f:formContainers>
			</f:Form>
		</VBox>
	</l:Grid>
</mvc:View>

ClaimInfoChange.xml.view

<mvc:View controllerName="com.tmclaimsz_tm_claims.controller.claim.Claim" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core"
	xmlns:t="sap.ui.table">
	<l:Grid defaultSpan="L12 M12 S12">
		<VBox>
			<f:Form id="DetailsOfClaims" editable="true">
				<f:title>
					<core:Title text="Details Of Claims"/>
				</f:title>
				<f:layout>
					<f:ResponsiveGridLayout labelSpanXL="2" labelSpanL="2" labelSpanM="2" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4"
						emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleContainerFullSize="false"/>
				</f:layout>
				<f:formContainers>
					<f:FormContainer>
						<f:formElements>
							<f:FormElement label="Claim ID">
								<f:fields>
									<Input value="{/0/ClaimId}" id="sClaimIdInput"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
							<f:FormElement label="Status">
								<f:fields>
									<Input value="{/0/ClaimStatus}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
					
						<f:formElements>
							<f:FormElement label="Delivery Date">
								<f:fields>
									<Input value="{/0/DeliveryDate}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
						<f:formElements>
							<f:FormElement label="Total Amount">
								<f:fields>
									<Input value="{/0/TotalAmountInt}"/>
								</f:fields>
							</f:FormElement>
						</f:formElements>
					</f:FormContainer>
				</f:formContainers>
			</f:Form>
		</VBox>
	</l:Grid>
</mvc:View>

claim.controller.js

onPressSave: function(oEvent) {

	console.log("payment Input Amount", sap.ui.getCore().byId("sClaimIdValue"));
	console.log("payment Input Amount", this.getView().byId("sClaimIdValue"));
}

when pressing save button still undefined. I want to get the value of the element of the Input.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK