Suppose I have a DataView instance with items created according to a template, say “#name# ”.
Q: If I click on an item, how do I get its name?
I know DataView has a method “get( id )”, which returns an object (item) given its id, but then what? How to I get from this object the properties such as specified in the template, such as ‘name’ in this case?
I found the answer to my own question. Sharing it here so it might be of use to others.
Answer:
If the template is e.g. “#name#”, and the id of a DataView item is ‘id’, then the object
can be retrieved via
var obj = dataview.get(id); // dataview = DataView instance.
Next, the “name” of the objected can be obtained simply via
obj.name
.