on 05-18-2015 4:07 PM
Hi,
I've MVC app with text field and I want that when the user enter some text on it it will change the drop down selected value,
How should I do that ?
Example will be very helpful
This is the text field and for example when you type aaa I want that the drop down will have aaa selected
for example the drop down contain aaa bbb ccc etc
var tF = new sap.ui.commons.TextField({
liveChange: [oController.onChange, oController]
});
I saw the last example here but its not helpful since this example is not using MVC
I need somehow in the live change of the text field do the drop down logic to change the selected value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Any way how to do that right ?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Stephane,
The example that I provided is with JSON model. You have to implement same logic for Odata model in your case except that you have to collect your entity set into an array and filter the values based on input values.
var oHelpModel = new sap.ui.model.json.JSONModel();
if (DATABINDING) {
console.log("Gateway Databinding for Value Help");
// http:///sap/opu/odata/sap//MaterialSet?$select=Matnr,Descr&$format=json
var helpURL = "http:///sap/opu/odata/sap//MaterialSet";
var queryString =”$select=Matnr,Descr&$format=json”;
oHelpModel.loadData( helpURL, queryString, false);
}
else {
console.log("Local Databinding for Value Help");
oHelpData =
{"d":{"results":[
{"Matnr":"4711","Descr":"Snowboard"},
{"Matnr":"4712","Descr":"Mountain Ski"},
{"Matnr":"4713","Descr":"Backcountry Ski"},
{"Matnr":"4714","Descr":"Freeride Ski"},
{"Matnr":"2011001","Descr":"Ski Boots"},
{"Matnr":"2011002","Descr":"Ski Poles"},
{"Matnr":"2011003","Descr":"Rucksack"},
{"Matnr":"5550001","Descr":"Ski Googles"},
{"Matnr":"5550002","Descr":"Ski Helmet"},
{"Matnr":"5550007","Descr":"GPS Unit"}
]}};
oHelpModel.setData(oHelpData);
}
oHelpTable.setModel(oHelpModel);
oHelpTable.bindAggregation("rows", "/d/results");
Hope it helps.
Regards
Uday
HI Again,
any idea how to solve it?
example will be very helpful
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Stephane,
Are you referring to Value help field ?
Please check following links.
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.commons.ValueHelpField
Regards
Uday
Something like this.
You can give some values in textfield like aaa,bbb,ccc, etc and see the corresponding change in dropdown
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI indrajith,
This is close but not exactly what I mean,its working in your example (and in the example which I add in the first post )but sinceI use MVC and the text field is like following
var tF = new sap.ui.commons.TextField({
liveChange: [oController.onChange, oController]
});
I need somehow to delegate the functionality to the controller i.e. when user type text in the liveChange event
liveChange: [oController.onChange, oController]
I need to call in the controller also to some event in the DDB to change the selected value...
This is the big question here,how to do that ?
Regards,
Stephen
Hi Stephane,
Hope this example helps - JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kedar
This is not what I meant ...:)
you need to have two controls
1.text field
2.drop down box
when you type in the field aaa the DDB should change the selected key .
the text field is using the livechange event and when you type on something there the liveChange event will call to the DDB some event and change the selected key
the drop down box should somehow listen to the livechange event in the text field...
its not that simple since the text field is implemented like following when the event logic is handeld in the controller....
var tF = new sap.ui.commons.TextField({
liveChange: [oController.onChange, oController]
});
Thanks!
Hi Stephane,
Hope this example works - JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...
In input field put in value 1 and you will see values associated with Test 1 from the JSON Model.
Thanks keder,
closer but not the answer I see that this is works but you handle the changes inline like following
liveChange: function(e){
oFilter = new sap.ui.model.Filter('Test',sap.ui.model.FilterOperator.EQ,e.getParameter("value"));
oTestTxt.bindAggregation("items","/Data",oItem,null,oFilter);
}});
here you call to oTestTxt but as my previos post this live change have the given code which call to the controller with the method name(handle method and this) and since I use mvc (which is the way to go...)this raise some problem,
liveChange: [oController.onChange, oController]
any idea how to solve it?
Here it is:
In you view in Input you would define something like this:
var oText = new sap.m.Input({description:'Enter test value',
liveChange: function(e){
oController.handlelivechange(e)
}});
In your Controller:
handlelivechnage: function(e){
here get the instance of dropdown box and its related item using sap.ui.getCore().byId("id")
and then change the aggregation binding.
};
Hope this helps.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.