on 10-22-2012 2:47 PM
Hi,
Does anybody knows how I can use the value of a SingleRowSelect as the src for an image.
I can only find exemples where they use the SingleRowSelect function to fill a textfield:
e.g.
productDetailsLayout.createRow(
new sap.ui.commons.Label({text:"Model", width:"100px"}),
new sap.ui.commons.TextField("model",{editable:false, width:"150px", value : "{model}", required : true}),
new sap.ui.commons.Label({text:"Description", width:"100px"}),
new sap.ui.commons.TextField("description",{editable:false, width:"150px", value : "{description}", required : true}),
new sap.ui.commons.Label({text:"Price", width:"100px"}),
new sap.ui.commons.TextField("price", { editable: false, width: "200px", value: "{price}", required: true }),
new sap.ui.commons.Label({ text: "Image", width: "100px" }),
new sap.ui.commons.Image({src: "{detail_url}", width: "200px", height: "200px"})
);
With this code all the textfields will be filled with the selected data, but I can't show the image.
So If anyone knows what I have to change in line 9 in the code above, please tell me!
Thanks,
Robbe Wuyts
Hi.
I think the problem is in your URL, try to put in a relative path.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robbe
For me that looks like it should work. Is the URL for the "detail_url" fully qualified, ie can you put it in the address bar and find and display an image?
As an alternative you could use, which works for me.
var oImage = new sap.ui.commons.Image().bindProperty("src", "detail_url");
oImage.setHeight("200px");
oImage.setWidth("200px");
Cheers
John P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, i.e. the url from the first line is:
HTTP://WWW.BEHRINGER.COM/ASSETS/B212XL_P0A0R_RIGHT_XL.PNG
Here's the code I use for my signleRowSelect:
ProductTable.attachRowSelect(function (oEvent) { | |
var currentRowContext = oEvent.getParameter("rowContext"); | |
var selectedUserID = oModel.getProperty("model", currentRowContext); | |
OData.read("http://scvwis0046.dcsc.be:8010/sap/opu/odata/sap/Z_RFM_BEHRINGER_CM_WR/z_rfm_behringer_wrCollection('" + selectedUserID + "')", | |
function (response) { | |
sap.ui.getCore().getControl("model").setValue(response.model); | |
sap.ui.getCore().getControl("description").setValue(response.description); | |
sap.ui.getCore().getControl("price").setValue(response.price); | |
sap.ui.getCore().getControl("detail_url").setValue(response.detail_url); |
}); |
}); |
This code doesn't work for me.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
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.