Skip to Content

sapui5 set value state to data aggregated control

Hi Everyone,

I'm trying to set value state to data binded thanks to aggregation binding. it doesn't seems to work :

I'm using the following syntax :

this.getView().byId("input15").setValueState(sap.ui.core.ValueState.Error);

it doesn't seem to work.

i tried to set manually the value to 'error" that way :

<Label text="Puissance électrique maximum installée" id="label20_1546424238324"/>
<Input width="100%" id="input15" description="kW" value="{tableDataBis>PuissMaxInst}" type="Number" required="true" valueState="Error"/>

and even there with the following I couldn't collect the right state.

this.getView().byId("input15").getValueState()

I think it is related to aggregation binding but despite research, I didn't found solution to apply error state to binded data that way.

could you help me ? here is the way I searched the model to update data to my screen :

var sPath = this.getView().byId("it_item").getBinding("pages").aKeys[0];
var oModel = this.getView().getModel("tableDataBis");
oModel.setProperty("/" + sPath + "/Nom1Societe", dataTable.NameOrg1);

It may be something to do there ?

thanks by advance.

kind regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Hi,

    I've tried to simulate your example and can set the valuestate without any issues. Can you please share the rest of your view or at least the table etc?

    Have you bound your controls probably inside the aggregation of the table or list?

    <Table id="table" width="auto" items="{ path: '/Orders', sorter: { path: 'EmployeeID', descending: false } }"
    				noDataText="{worklistView>/tableNoDataText}" busyIndicatorDelay="{worklistView>/tableBusyDelay}" growing="true" growingScrollToLoad="true"
    				updateFinished="onUpdateFinished">
    				<headerToolbar>
    					<Toolbar>
    						<Title id="tableHeader" text="{worklistView>/worklistTableTitle}"/>
    						<ToolbarSpacer/>
    						<SearchField id="searchField" tooltip="{i18n>worklistSearchTooltip}" search="onSearch" width="auto"></SearchField>
    					</Toolbar>
    				</headerToolbar>
    				<columns>
    					<Column id="nameColumn">
    						<Text text="{i18n>tableNameColumnTitle}" id="nameColumnTitle"/>
    					</Column>
    					<Column id="unitNumberColumn" hAlign="End">
    						<Text text="{i18n>tableUnitNumberColumnTitle}" id="unitNumberColumnTitle"/>
    					</Column>
    				</columns>
    				<items>
    					<ColumnListItem type="Navigation" press="onPress">
    						<cells>
    							<ObjectIdentifier title="{EmployeeID}"/>
    							<Input value="{OrderID}" valueState="Error"/>
    						</cells>
    					</ColumnListItem>
    				</items>
    			</Table>
     example
    Add comment
    10|10000 characters needed characters exceeded

  • Hi Jakob,

    here is an extract of the view (it is too huge to be displayed entirely here). this isn't my root view.

    <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" controllerName="Oa_solaire_C13.Oa_solaire_C13.controller.View_form2">
    	<App class="sapUiResponsiveMargin" width="auto" id="it_item" pages="{tableDataBis>/ContratC13Set}" cd:w5g.dt.context="tableDataBis>/ContratC13Set">
    		<pages>
    			<Page xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" id="page0" title="{i18n>titleView2} {tableDataBis>Contrat}" showNavButton="true" navButtonPress="action" action:wiring="\{'navButtonPress':\{'navigation':\{'routeName':'Vue_accueil'\}\}\}" validateFieldGroup="onValidateView2" showFooter="false">
    				<content>
    					<sap.ui.layout.form:SimpleForm xmlns:sap.ui.layout.form="sap.ui.layout.form" editable="true" layout="ResponsiveGridLayout" id="form2">
    						<sap.ui.layout.form:content>
    							<core:Title text="Caractéristiques principales de cette installation" id="title2"/>
    							<Label text="Nombre et type de générateurs" id="label19"/>
    							<Input xmlns="sap.m" id="input24" editable="{= ${tableDataBis>Estat}==='E0005'}" value="{tableDataBis>NombreGenerateurs}" type="Number"/>
    							<Select xmlns="sap.m" id="select0" cd:w5g.dt.context="tableDataBis>/ContratC13Set" items="{path: 'tableDataBis>/ZisuRTypeGeneSet', templateShareable:false}" selectedKey="{tableDataBis>TypeGenerateur}" blocked="{= ${tableDataBis>Estat}!=='E0005'}">
    								<items>
    									<core:Item xmlns:core="sap.ui.core" key="{tableDataBis>ZisuTypeGenerateur}" text="{tableDataBis>Designation}" id="item2"/>
    								</items>
    							</Select>
    							<Label text="Puissance électrique maximum installée" id="label20_1546424238324"/>
    							<Input width="100%" id="input15" editable="{= ${tableDataBis>Estat}==='E0005'}" description="kW" value="{tableDataBis>PuissMaxInst}" type="Number" required="true" valueState="{path : 'tableDataBis>PuissMaxInst', formatter : '.getStateByPropertyValue'}"/>
    							<Label text="Point de livraison" width="100%" id="label6"/>
    							<Input width="100%" id="input16" editable="{= ${tableDataBis>Estat}==='E0005'}" value="{tableDataBis>Pdl}"/>
    							<Label xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:sap.ui.layout.form="sap.ui.layout.form" text="Tension de livraison" id="label17_copy5"/>
    							<Input width="100%" id="input17" editable="{= ${tableDataBis>Estat}==='E0005'}" description="V" value="{tableDataBis>TensionLivraison}" type="Number"/>
    							<Label xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:sap.ui.layout.form="sap.ui.layout.form" text="Puissance électrique garantie en hiver" id="label17_copy6"/>
    							<Input width="100%" id="input18" editable="{= ${tableDataBis>Estat}==='E0005'}" description="kW" value="{tableDataBis>PuissGarantieH}" type="Number"/>
    							<Label xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:sap.ui.layout.form="sap.ui.layout.form" text="Zone de desserte en gaz à laquelle est raccordée l’installation" id="label17_copy7"/>
    							<HBox width="100%" id="hbox0">
    								<items>
    									<RadioButtonGroup xmlns="sap.m" columns="4" id="GroupA" editable="{= ${tableDataBis>Estat}==='E0005'}" cd:w5g.dt.context="tableDataBis>/ContratC13Set" select="onSelectZoneDesserte">
    										<buttons>
    											<RadioButton xmlns="sap.m" groupName="GroupA" text="Nord H" id="button6" selected="{= ${tableDataBis>ZoneDesserte}==='1'}" fieldGroupIds="1"/>
    											<RadioButton xmlns="sap.m" groupName="GroupA" text="Nord B" id="button4" selected="{= ${tableDataBis>ZoneDesserte}==='2'}" fieldGroupIds="2"/>
    											<RadioButton xmlns="sap.m" groupName="GroupA" text="Sud" id="button7" selected="{= ${tableDataBis>ZoneDesserte}==='3'}" fieldGroupIds="3"/>
    											<RadioButton xmlns="sap.m" groupName="GroupA" text="TIGF" id="button5" selected="{= ${tableDataBis>ZoneDesserte}==='4'}" fieldGroupIds="4"/>
    										</buttons>
    									</RadioButtonGroup>
    								</items>
    							</HBox>
    						</sap.ui.layout.form:content>
    					</sap.ui.layout.form:SimpleForm>
    					<Button xmlns="sap.m" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" text="Ajouter Pièce jointe" id="button0" visible="{= ${tableDataBis>Estat}==='E0005'}" icon="sap-icon://attachment" press="action" action:wiring="\{'press':\{'navigation':\{'routeName':'Page_binded','keys':[\{'name':'Contrat','type':'Edm.String'\}],'model':'tableDataBis'\}\}\}"/>
    					<Button xmlns="sap.m" icon="sap-icon://save" text="Valider le formulaire" visible="{= ${tableDataBis>Estat}==='E0005'}" id="button3" press="onSave"/>
    					<Button xmlns="sap.m" text="Signature électronique" id="button10" icon="sap-icon://signature" press="onPressSignature" visible="{= ${tableDataBis>Estat}==='E0005'}" cd:w5g.dt.context="tableDataBis>/ContratC13Set"/>
    					<Button xmlns="sap.m" text="Abandonner demande" id="button11" icon="sap-icon://cancel" visible="{= ${tableDataBis>Estat}==='E0005'}" cd:w5g.dt.context="tableDataBis>/ContratC13Set" press="OnPressAbandon"/>
    				</content>
    			</Page>
    		</pages>
    	</App>
    </mvc:View>
    
    
    
    

    root view permit to select an entry from a table. View_form2 display data from corresponding selected line.

    I think aggregation binding by use of template in web ide may be the reason for my Issue.

    control is launched when clicking on save button.

    Kind regards,

    Jean-François Parmentier.

    Add comment
    10|10000 characters needed characters exceeded