avatar image
Former Member

How to refresh list in sapui5

I've a list which is initialized when application starts. I'm performing crud operation. when i'm deleting any item, or adding any item, It doesn't refreshed.

var listRules=that.getView().byId("lstAutomationRules");
listRules.getModel().refresh();

I use above approach to refresh my list. but it doesn't work. the code of list back-end is as below.

<List id="lstAutomationRules" itemPress="onListItemPress" showUnread="true" items="{/d/results}">
	<infoToolbar>
		<Toolbar visible="false" id="idInfoToolbar">
			<Label id="idFilterLabel"/>
		</Toolbar>
	</infoToolbar>
	<items>
		<StandardListItem title="{name}" type="Active" description="{description}" custom:to="{id}"/>
	</items>
</List>
//prepare url for fetching records.....
var url = sap.samhengi.util.replaceDoubleCurleyBrackets(that.conf.fetchAutomationRules);
$.ajax({
url: url,
method: "GET",
dataType: "json",
headers: {
	"Accept": "application/ld-frame+json"
}
}).done(function(data) {
var oModel = new sap.ui.model.json.JSONModel(data);
//binding model... 
that.getView().setModel(oModel);
}).fail(function(error) {
reject();
});
});
refreshlist.png (34.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 13, 2017 at 12:57 PM

    try below code once:

    oList.getModel().updateBindings(true)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 16, 2017 at 09:45 PM

    HI Nafees

    I believe that it is due to caching. I may be wrong. try this (cache: false)

    $.ajax({
    url: url,
    method: "GET",
    dataType: "json",
    cache: false,
    headers: {
    	"Accept": "application/ld-frame+json"
    }

    Thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content