cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with data binding on sapui5 [Same value is showed in my list.]

Former Member
0 Kudos

i have the next issue on my app made in sap web ide with sapui5 app template.

i want to show some values, the values are retrieved by a search field, everything works fine, but the issue i have is, the searched values what are shown are the same. in all entries.

Data showed on the app.

on the left side, the values must be differents, so i don't know how is not working. here are my code.

<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout"
	xmlns:f="sap.ui.layout.form" xmlns="sap.m" xmlns:sap.comp.variants="sap.ui.comp.variants" controllerName="com.my.controller.List">
	<App>
		<pages>
			<Page title="{i18n>title}">
				<content>
					
	<List items="{path:'/PTOS_INSPSet'}" id="puntosList" growing="true" growingThreshold="10" growingScrollToLoad="false" mode="SingleSelectMaster" selectionChange="onItemSelected">
		<headerToolbar>
			<Toolbar>
				<Title text="{i18n>puntosListTitle}"/>
					<ToolbarSpacer/>
				<SearchField width="50%" search="onFilter"/>
			</Toolbar>
		</headerToolbar>
		<items>
			<ObjectListItem title="{Userc1}" >
				<firstStatus>
					<ObjectStatus text="{IEbeln}"/>
				</firstStatus>
			</ObjectListItem>
		</items>
	</List>
</content>
			</Page>
		</pages>
	</App>
</mvc:View>
<br>

this in on the view.

and this is my controller por the button search.

<code>   
 onFilter:function(oEvent){var aFilter =[],
 sQuery = oEvent.getParameter("query");
if(sQuery && sQuery.length >0){
       aFilter.push(newFilter("IEbeln",FilterOperator.Contains, sQuery));

}
var oList = this.getView().byId("puntosList");

var oBinding = oList.getBinding("items");
oBinding.filter(aFilter);}

all of this is retrieved from a private odata service declared on my manifest.

Accepted Solutions (1)

Accepted Solutions (1)

vaibhav_gb
Explorer

Try making Userc1 also as a key along with IEbeln(the current Key), that should probably solve your issue. if that also does not work then try and make these variables filterable along with key.

Former Member
0 Kudos

Hello Vaibhav.

I will check that!.

Thanks for your response.

Former Member

This was the problem.

Thank you Vaibhav.

junwu
Active Contributor
0 Kudos

are they really key? they may just work for this search only.

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

don't know what u are talking.

what is "only last is shown"? if only last is shown, you should only see one record....

can u show me the result from the network tab?

Former Member
0 Kudos

Sure, here it is, i only want to show the Userc1 value on the fields, but i don't know why only bring me one, IEbeln is the key.

{"d":{"results":[{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000522","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"GDQ12344","Userc2":"JC-1312"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000526","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"GD123456789","Userc2":"JH-6980"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000526","Vorglfnr":"00000003","Probenr":"000002","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"GD123456789","Userc2":"JC-1312"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000561","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"000000001234567883","Userc2":"JF-1451"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000664","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"000000001234567883","Userc2":"0000001234"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000675","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"000000000000000123","Userc2":"0000001234"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000770","Vorglfnr":"00000003","Probenr":"000001","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"000000000000456789","Userc2":"JF-1451"},{"__metadata":{"id":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","uri":"http://172.20.0.16:8000/sap/opu/odata/sap/ZQMGW_PUNTOS_INSP_SRV/PTOS_INSPSet('4501017510')","type":"ZQMGW_PUNTOS_INSP_SRV.PTOS_INSP"},"IEbeln":"4501017510","Type":"","Id":"","Number":"000","Message":"","LogNo":"","LogMsgNo":"000000","MessageV1":"","MessageV2":"","MessageV3":"","MessageV4":"","Parameter":"","Row":0,"Field":"","System":"","Prueflos":"000000000770","Vorglfnr":"00000003","Probenr":"000002","Teillos":"000000","Menge":"0.000","MengeA":"0.000","Mengeneinh":"","Tplnr":"","Phynr":"","Userc1":"000000000000898789","Userc2":"JF-1451"}]}}

junwu
Active Contributor

if IEbeln is the KEY, why it brings u so many records with one key value? your design is wrong, probably.

Former Member
0 Kudos

because IEbeln has a relation with userc1, so, one record of IEbeln can be realtioned with one or more Userc1 values.

junwu
Active Contributor
0 Kudos

hopefully you understand what i am talking

redesign ok?

Former Member
0 Kudos

Ok, i will check the backend service.

Thanks.

junwu
Active Contributor
0 Kudos

does the odata give correct data?

Former Member
0 Kudos

Hello Jun.

Yes, i looked on my batch on the console and the data is there, but in my xml view, shows the last entry.

Greetings.

junwu
Active Contributor
0 Kudos

it shows the last entry as multiple rows in the table?

Former Member
0 Kudos

Yes, the first entry what i marked on the image, Is the value that should change, but shows the same value.

junwu
Active Contributor
0 Kudos

don't know what u are talking

why it should change?

Former Member
0 Kudos

because when i search on the search field, it supposed to bring me all the data relationed to the text who i write on the field.

shows to me eight entries, that is correct, but the 8 entries shows the same value, the left value is what i'm talking about.

junwu
Active Contributor
0 Kudos

did the backend give u 8 entries with different value?

Former Member
0 Kudos

i checked the batch and gives to me the metadata with all the values, but only the last is showed.