Hi,
I am trying to create multi input dynamically when i press on add button. So once i select the value and then that multi input is populated. But when i press on add button the previous multi input values are cleared. And i have to select again.When i debugged it is going to core library and the value is getting cleared. Wanted to know is there any option to retain that value in multi input when i press add button. Please find the attached code and launchpad configuration. Please help me with this
s1This.id = 1;
addMaterial: function(evt)
{
var tbody = s1This.byId('materialTable');
var column = new sap.m.ColumnListItem();
var txt1 = new sap.m.MultiInput("S1--txt1"+s1This.id,{
value:"",
valueStateText : "{i18n>mtnNo}",
valueHelpRequest:function(evt)
{
s1This.getController().onValueMat(evt);
}
}).addStyleClass("material1");
var txt2 = new sap.m.Input("S1--txt2"+s1This.id,{
valueStateText : "{i18n>ordrQty}",
liveChange:function(oEvent){
qunty=oEvent.getSource().getValue();
}
}).addStyleClass("material2");
var btnD = new sap.m.Button("btnId"+s1This.id,
{
icon:"sap-icon://delete",
press:function(evt)
{
s1This.getController().deleteRow(evt);
}
});
column.addCell(txt1);
column.addCell(txt2);
column.addCell(btnD);
tbody.addItem(column);
s1This.id = s1This.id + 1;
},
onValueMat:function(evt)
{
var evt1 = evt.getSource();
var matId = evt1.sId+"-inner";
var ws = sap.ui.getCore().getModel("i18n").getResourceBundle().getText("mtnNo");
var dws = sap.ui.getCore().getModel("i18n").getResourceBundle().getText("Desc");
var title = sap.ui.getCore().getModel("i18n").getResourceBundle().getText("mtnNo");
var helpModel = sap.ui.getCore().getModel("batchModel");
var matModel = helpModel.oData[0].data.results;
var oDialog = new sap.m.TableSelectDialog
({
title : title,
columns :[new sap.m.Column
({
width: "3em",
header : new sap.m.Text({text:ws}),
minScreenWidth:"Tablet",
popinDisplay:"Inline",
demandPopin : true,
hAlign:"Center"
}),
new sap.m.Column
({
width: "4em",
header : new sap.m.Text({text:dws}),
minScreenWidth:"Tablet",
hAlign:"Center"
})
],
search: function searchData(data)
{
var sval = data.getParameter("value");
var oFilter = new sap.ui.model.Filter("Maktx",sap.ui.model.FilterOperator.Contains,sval);
var oBinding = data.getSource().getBinding("items");
oBinding.filter([oFilter]);
},
confirm: function handleGet(handle)
{
var oContext = handle.getParameter('selectedContexts');
if (oContext.length)
{
oContext.map(function(cont)
{
Desc05 = cont.getObject().Matnr;
DistCh = cont.getObject().Maktx;
$("#"+evt1.sId+"-inner").val(Desc05);
});
}
materialNo = matNo.getValue();
},
cancel: function(dilg)
{
}
}).addStyleClass("dialHead");
var lst = new sap.m.ColumnListItem({
type :"Active",
cells:[new sap.m.Text({
text:"{Matnr}"
}),
new sap.m.Text({
text:"{Maktx}"
})
]});
var model = new sap.ui.model.json.JSONModel();
model.setData(matModel);
oDialog.setModel(model);
oDialog.bindItems("/",lst);
oDialog.open();
}