PDA

View Full Version : itemSelector for different nodes



dbloom
30 Apr 2012, 10:10 AM
I am using the widget.dataview where i have two different type of nodes (file-list-item and folder-list-item) and the template goes something like this:

tpl: ['<tpl for=".">',
'<tpl if="folder==false">',
'<div class="file-list-item">{name}</div>',
'</tpl>',
'<tpl if="folder==true">',
'<div class="folder-list-item">{name}</div>',
'</tpl>',
'</tpl>'

This displays fine, but when I go to select each type of node with the item selector defined as :
itemSelector: '.folder-list-item',

it handles the (folder-list-item) fine, but how do i configure the itemSelector to handle both type of nodes???

vietits
30 Apr 2012, 4:22 PM
Try this


tpl: [
'<tpl for=".">',
'<tpl if="folder==false">',
'<div class="node-list-item file-list-item">{name}</div>',
'</tpl>',
'<tpl if="folder==true">',
'<div class="node-list-item folder-list-item">{name}</div>',
'</tpl>',
'</tpl>'



...
itemSelector: '.node-list-item'
...