You can provide your own custom javascript function to template the items. This example shows how to create the same template you saw in scenario 1, except it uses an item templating function instead of a declarative item template.