View Full Version : DataView's 'singleSelect' not working

24 Feb 2011, 1:52 PM
Hello everyone,
I am trying to enable selection of the data in the dataview just like grid but it is not working for me. I am not sure what I am doing wrong. Everything seems to be fine. Here is the code

var tpl4 = new Ext.XTemplate (
'<tpl for=".">',
'<tpl if="values._post_id !=values._topic_first_post_id">',
'<div class="post-wrap">',

'<div id="post-body">',
'<span id="post-body-date">{_post_datetime:date("M j, Y")}<span style="color: #b90000; font-size: 11px;"> at</span> {_post_datetime:date(" H:i")}</span><span id = "post-content"> - {_post_content}</span><br>',
'<span style="font-size: 11px; color: #777777;">Posted by: <span style="color: #0085cf;">{_user}</span></span><br>',
'<div id="post-separator"></div>',

xtype: 'dataview',
id: 'postView'+record.data._topic_id,
overClass : 'post-over',
singleSelect: true,
cls: 'post-view-class',
tpl: tpl4,
loadingText: 'Loading Posts...',
emptyText: '<span style="padding-left: 10px; font-size: 15px; ">No update for this event yet!</span>',
store: new Ext.data.JsonStore({
fields : [
{ name : '_post_content', mapping : '_post_content' },
{name : '_topic_id',mapping:'_topic_id'},
{name: '_user_picture', mapping: '_user_picture'},
{ name : '_user', mapping : '_user' },
{ name : '_post_datetime', mapping : '_post_datetime', type: 'date', dateFormat: 'Y-m-d H:i:s' },
{name : '_post_id',mapping:'_post_id'},
{name: '_topic_first_post_id',mapping:'_topic_first_post_id'}
url: 'index.php',
totalProperty : 'totalCount',
root : 'post',
autoLoad : true,
remoteSort : true,
id: 'post_store',
baseParams: {
cmd: 'get_post_details',
itemSelector: 'div.post-wrap'


I have specified an 'overClass' and that works fine. But after clicking on the item, it doesnt show if its selected. I have also tried specifying selectedClass and that doesnt work either. Any help would be appreciated.


28 Feb 2011, 7:56 AM
The problem is resolved. I added selectedClass configuration option and it works now. The default selection class (x-view-selected) of dataview doesn't event exist.