cancel
Showing results for 
Search instead for 
Did you mean: 

Items not stored in multiComboBox after refresh

Former Member
0 Kudos
Hi,
Below is the code. In this code I have declared a variable name 
"roStremItems" in which I am getting the items which is in MultiComboBox
control, Problem is that when I navigate to this page, I can get all the 
items by using getItems() function from MultiComboBox control. But when I 
refresh this page it is not giving me the items.

Please see the screenshots afternavigation.jpg and afterrefresh.jpg for reference

var unitContextPath =evt.getParameter("arguments").unitContextPath;
var viewModel=this.getView().getModel();
viewModel.read("/"+unitContextPath, //Getting the data which under "/unitContextPath"
  {
    success:
      function(oData,oResponse)
         {
           oModel = new sap.ui.model.json.JSONModel();
           oModel.setData(oData); //Set Data from viewModel declare above
           sap.ui.getCore().byId("unitForm").setModel(oModel,"unit"); //Apply Data to "unitForm"
           getUnitCode=sap.ui.getCore().byId("unitCode_Input").getValue();
//Get "unitCode_Input" value this control is in view under simple form
control
           var filters =[];
           var aFilter;
           aFilter= new sap.ui.model.Filter("unit_code.unit_code",sap.ui.model.FilterOperator.EQ,getUnitCode);
filters.push(aFilter);
sap.ui.getCore().byId("unitBoxes_Input").getBinding("items").filter(filters);//Bind Items to "unitBoxes_Input" multiComboBox control

var roStreamItems=sap.ui.getCore().byId("unitBoxes_Input").getItems();
//Get Items which are bind in prev line. The issue is in this line on refresh this linke is not give the items.
sap.ui.getCore().byId("unitRo_Input").setSelectedItems(roStreamItems);
//Select the items which are binded
} ,
error:
function()
  {
    console.log("error retrieving the value of unit"); //Error will come if the service not found
}
Please Suggest.
Thanks in Advance
Somdutt

Accepted Solutions (1)

Accepted Solutions (1)

former_member365727
Active Contributor
0 Kudos

There is no persistent data storage in your application. Are you storing the selected checkboxes into a DB? if so then the same can be retrieved after page refresh as part of 'init' method of controller and loaded into the UI.

When you are navigating within the app, all the data is stored as part of JSON model and can be accessed. When you refresh the page JSON model is created again newly.

Answers (0)