I have a list that is automatically populated from an XML DataSource using bindings.
Each XML record contains a title, a description and a URL
Each UI row contains a title and a description.
When onclick
is called on the title, I would like to call the openURL with the URL specified in the DataSource.
Is it possible to identify the current selection and navigate in the datamodel from the onclickHandler
?
In a Dashcode project I'm working on right now I have a datasource that includes a URL to the product on Amazon.com. I haven't done this from the list view, but from my detail view I created a link to the Amazon page for the currently displayed product.
On the detail layout the URL field is transformed to be:
"Click here to purchase the product on Amazon.com."
And the word here is a standard html link.
I used a Value Transformer to do this. In my data source the URL field contains a fully qualified URL to the product on Amazon.com. So where you see "value" in the code below Dashcode is replacing that with a URL in the HTML code that is then included in the page.
myBuildAmazon = Class.create(DC.ValueTransformer,{
transformedValue: function(value){
// Insert Code Here
value="Click <a href="+value+" target='_blank' >here</a> to purchase the product on Amazon.com.";
return value;
}
});
One important thing is that when you bind the datasource to the field select HTML from the popup menu that comes up rather than Text.
I hope this helps.