Skip to Content
0

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

Jan 30, 2017 at 03:41 PM

122

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
VAIBHAV GB Jan 31, 2017 at 06:42 AM
2

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.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hello Vaibhav.

I will check that!.

Thanks for your response.

0

This was the problem.

Thank you Vaibhav.

1

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

0
Jun Wu Jan 30, 2017 at 04:15 PM
0

does the odata give correct data?

Show 7 Share
10 |10000 characters needed characters left characters exceeded

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.

0

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

0

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

0

don't know what u are talking

why it should change?

0

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.

0

did the backend give u 8 entries with different value?

0
Show more comments
Jun Wu Jan 30, 2017 at 06:17 PM
0

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?

Show 5 Share
10 |10000 characters needed characters left characters exceeded

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"}]}}

0

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

1

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

0

hopefully you understand what i am talking

redesign ok?

0

Ok, i will check the backend service.

Thanks.

0