on 08-09-2015 1:15 PM
Hi All,
I have a ui5 application on HANA for updating values.
On clicking update button, the value is updated and the table model is loaded with data again through the xsjs file. And thus the table refreshes to show new value immediately.
This function was working fine. But on adding a message box with success icon on clicking update, the refresh feature stops working properly. It works 5 out of 10 times. Sometimes, 1st update shows no result, 2nd update shows the values which was updated in the 1st time and so forth.
Also, the application stops to show new changes. It is as if it gets corrupted. Removing the message box code also doesn't help. Only way is to either make a copy of the app without the message box code and activate or else UNDO the changes and revert till before the addition of message box code.
Any idea why this is happening?
Help appreciated.
Thanks in advance
Ritu J
Hi Ritu
It is hard to tell unless you share some code.
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
There are two options I tried:
1. inside a function after update which contains the refresh of table models:
function afterUpdate()
{
//var rModel = new sap.ui.model.json.JSONModel("rModel");
rModel.loadData("services/details.xsjs?det=details&d1="+selectedval);
//var rsModel = new sap.ui.model.json.JSONModel();
rsModel.loadData("services/details.xsjs?det=status&s1="+selectedval);
// copied from open ui5 example
jQuery.sap.require("sap.ui.commons.MessageBox");
// open a fully configured message box
sap.ui.commons.MessageBox.show("Ruling the world is a time-consuming task. You will not have a lot of spare time.\nStill convinced to do it?",
sap.ui.commons.MessageBox.Icon.WARNING,
"This could be dangerous",
[sap.ui.commons.MessageBox.Action.YES, sap.ui.commons.MessageBox.Action.NO],
sap.ui.commons.MessageBox.Action.YES);
}
There is no change. The message box does not seem to work but update and refresh works fine.
2. Inside the controller, on clicking the update button
update : function(j) {
//alert("Open update! ");
var oSHTable = sap.ui.getCore().byId(j);
var i = oSHTable.getSelectedIndex();
if(i == -1)
{
alert("Please select a row to update");
return;
}
else if(i>=0)
{
var selectedRow = oSHTable.getContextByIndex(i);
var selectedval = selectedRow.getProperty('roundid');
var selectedval2 = selectedRow.getProperty('seqid');
var selectedval4 = selectedRow.getProperty('supcomments');
var selectedval3 = selectedRow.getProperty('READUPD');
if(selectedval3==null)
{
alert("Please enter reading" );
return -1;
}
if(selectedval4==null){
alert("Please enter comments" );
return -1;
}
if(selectedval3=="")
{
alert("Please enter reading" );
return -1;
}
if(selectedval4==""){
alert("Please enter comments" );
return -1;
}
else
{
var aUrl = 'services/update.xsjs?cmd=multiply'+'&d1='+ selectedval+'&d2='+selectedval2+'&d3='+selectedval3+'&d4='+selectedval4;
jQuery.ajax({
url: aUrl,
method: 'GET',
dataType: 'json',
success: this.onCompleteMultiply2,
error: this.onErrorCall2 });
alert("Updated!!!");
// copied from open ui5 example
jQuery.sap.require("sap.ui.commons.MessageBox");
// open a fully configured message box
sap.ui.commons.MessageBox.show("Ruling the world is a time-consuming task. You will not have a lot of spare time.\nStill convinced to do it?",
sap.ui.commons.MessageBox.Icon.WARNING,
"This could be dangerous",
[sap.ui.commons.MessageBox.Action.YES, sap.ui.commons.MessageBox.Action.NO],
sap.ui.commons.MessageBox.Action.YES);
return 0;
}
}
}
When the alert 'Updated!!!' is present, the code works fine as expected and refreshes correctly. Once I remove the alert, it shows all the problems.
May be the alert is buying some time to make the refresh work correctly. I cannot understand.
Thanks!
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.