PDA

View Full Version : Dataview and multiselect not working?



miroperez
6 Feb 2011, 8:03 AM
I'm trying to have a dataview which allows the user to tap multiple items and have them each be selected but each click causes the previous selection class to be removed.

I did a quick test with the sample code from nestedLoading.js which loads user orders and added the multiSelect: true and simpleSelect: true and I still see the previous selection class get removed from the itemSelector.



{
xtype: 'dataview',

/*
* The XTemplate allows us to easily render the data from our User model, as well as
* iterating over each User's Orders and OrderItems:
*/
tpl: [
'<tpl for=".">',
'<div class="user">',
'<h3>{name}\'s orders:</h3>',
'<tpl for="orders">',
'<div class="order" style="padding-left: 20px;">',
'Order: {id} ({status})',
'<ul>',
'<tpl for="orderItems">',
'<li>{quantity} x {name}</li>',
'</tpl>',
'</ul>',
'</div>',
'</tpl>',
'</div>',
'</tpl>'
],

itemSelector: 'div.user',
styleHtmlContent: true,
multiSelect: true,
singleSelect : false,
simpleSelect: true,
store: new Ext.data.Store({
model: 'User',
autoLoad: true
})
}



Am I missing something or misunderstanding the docs here?

Thanks,
Miro

miroperez
6 Feb 2011, 9:13 AM
Just a little more info on this one. I couldn't find anywhere in the code path where the multiSelect property is actually getting used. It looks like the dataview.getSelectionModel() has a SINGLE and MULTI selection mode, but I don't see that getting set anywhere based on the multiSelect property in DataView.

gcallaghan
6 Feb 2011, 8:24 PM
depending on the mode you want you may also need to enable simpleSelect

miroperez
7 Feb 2011, 7:16 AM
Right. I enabled that in the config above and it didn't change anything. The item being clicked had the selected cls applied to it but the next click on another item removed that cls and applied it to the next one. It's as if the multiselect config property is being ignored. I made this change directly in the examples directory and didn't see any change.

I think I'm running into the same as this issue:

http://www.sencha.com/forum/showthread.php?119986-OPEN-700-(1.0.1)-DataView-Multiselect-issue.

gcallaghan
7 Feb 2011, 9:21 AM
Ahh, I've only done this on an Ext.List. Not specifically a data view.

miroperez
12 Feb 2011, 7:31 AM
It turns out I was running version 1.0 and it's been fixed in 1.0.1a.

jep
4 Sep 2011, 8:43 AM
Could you take a look at my post #6 here and see if this is related?

http://www.sencha.com/forum/showthread.php?116336-FIXED-580-List-multiSelect-and-allowDeselect-%28singleSelect%29-not-working&p=644627&viewfull=1#post644627

I cannot for the life of me get multiSelect to work for an Ext.List.