on 07-28-2015 1:29 PM
Hi everyone ,
In sap.m , XML view i need to display a form , in which the field values should change dynamically,
in accordance with my input and button press.
my UI looks like the below
this is my "controller.js" code:
-----------------------------------------------------
press: function() {
input1=this.getView().byId("inp1").getValue();
input2=this.getView().byId("inp2").getValue();
var path= "/creditData1Set?$filter=Creditcontrolarea'+' '+'eq'+' '+"'"+input1+"'"+' '+'and'+' '+'Customer'+''+'eq'+' '+"'"+input2+"'" " ;
var frm = this.getView().byId("form_id");
frm.bindElement(path);
}
-----------------------------------------------------
but its not working
is this right way to bind oData to a Form.
pls suggest if having any idea on this.
thanks,
Chandran.
I see a lot of funky '+' operators and rogue single/double quotes in your string object, that doesn't seem right. You may want to debug the actual value of your variable 'path'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin,
Thanks for ur reply
i have tried with following,
var path= "/creditData1Set?$filter=Creditcontrolarea eq "+input1+"and Customer eq"+input2;
still its not working.
the actual value i mentioned above is working fine in table ,bindaggregation method.
but the same is not working in form binding.
anyother helpful ideas pls?
I'm not really sure, but I think the ODataModel only supports inline $expand and $select, not $filter
So I think you should get the binding from the model first, then create the filter, and then add it to the binding:
var oBinding = oModel.bindList("/creditDataSet");
var oFilter1 = new sap.ui.model.Filter("Creditcontrolarea", sap.ui.model.FilterOperator.Equals, input1);
var oFilter2 = new sap.ui.model.Filter("Customer", sap.ui.model.FilterOperator.Equals, input2);
oBinding.filter([oFilter1, oFilter2]);
Hi Gurung,
// -------------------------- view.xml -----------------------------------
<f:SimpleForm id="simpleform"
minWidth="1024"
maxContainerCols="2"
layout="ResponsiveGridLayout"
labelSpanL="4"
labelSpanM="4"
labelSpanS="4"
emptySpanL="1"
emptySpanM="1"
emptySpanS="1"
columnsL="2"
columnsM="2"
columnsS="1">
<f:content>
<core:Title text="{Title}" />
<Label text="First Name" /> <Text text="{Firstname}"/>
<Label text="Last Name" /> <Text text="{Lastname}"/>
<Label text="City" /> <Text text="{City}" />
</f:content>
</f:SimpleForm>
// ---------------------------------- controller.js ---------------------
// get input1 and input2 values
var simple_frm = this.getView().byId("simpleform")
simple_frm.bindElement('/fm_credit1Set(IM_parametr1='+"'"+input1+"'"+',IM_parametr2='+"'"+input2+"'"+')');
make sure that you have implemented 'Get_Entity (READ)' operation in your oData service.
Regards ,
Chandran
User | Count |
---|---|
87 | |
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.