PDA

View Full Version : 4.0.2a not deselecting multiselected grid in infinite scrolling



rspaeth
21 Jun 2011, 10:34 AM
After selection of multiple rows and clicking one of the selected rows, the clicked row is not being selected (and the other rows are not deselected) when using the scrolling grid, a selection model set to 'MULTI', and drag and drop.

tested on FF4 and 5 on mac osx

steps to reproduce:
1) select several rows (either by shift select or control/command collect)
2) release the shift, control, or command (whatever you were using )
3) select one of the already selected rows

current outcome:
nothing happens

expected outcome:
all rows are deselected, then the single row clicked becomes selected

note the grid viewConfig: This grid is actually coupled with another component where rows from the grid can be dragged to it (the other component is not included in the example). this is why enable drop is false.



Ext.Loader.setConfig({enabled: true});

Ext.Loader.setPath('Ext.ux', '../ux/');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.util.*',
'Ext.grid.PagingScroller'
]);

Ext.onReady(function(){
Ext.define('ForumThread', {
extend: 'Ext.data.Model',
fields: [
'title', 'forumtitle', 'forumid', 'author',
{name: 'replycount', type: 'int'},
{name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
'lastposter', 'excerpt', 'threadid'
],
idProperty: 'threadid'
});

// create the Data Store
var store = Ext.create('Ext.data.Store', {
id: 'store',
pageSize: 200,
model: 'ForumThread',
remoteSort: true,
// allow the grid to interact with the paging scroller by buffering
buffered: true,
proxy: {
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
type: 'jsonp',
url: 'http://www.sencha.com/forum/remote_topics/index.php',
extraParams: {
total: 50000
},
reader: {
root: 'topics',
totalProperty: 'totalCount'
},
// sends single sort as multi parameter
simpleSortMode: true
},
sorters: [{
property: 'lastpost',
direction: 'DESC'
}]
});

function renderTopic(value, p, record) {
return Ext.String.format(
'<a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a>',
value,
record.data.forumtitle,
record.getId(),
record.data.forumid
);
}


var grid = Ext.create('Ext.grid.Panel', {
width: 700,
height: 500,
title: 'ExtJS.com - Browse Forums',
store: store,
verticalScrollerType: 'paginggridscroller',
loadMask: true,
disableSelection: false,
invalidateScrollerOnRefresh: false,
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
ddGroup: 'test',
enableDrop: false
}
},
// grid columns
columns:[{xtype: 'rownumberer',width: 50, sortable: false},{
// id assigned so we can apply custom css (e.g. .x-grid-cell-topic b { color:#333 })
// TODO: This poses an issue in subclasses of Grid now because Headers are now Components
// therefore the id will be registered in the ComponentManager and conflict. Need a way to
// add additional CSS classes to the rendered cells.
id: 'topic',
text: "Topic",
dataIndex: 'title',
flex: 1,
renderer: renderTopic,
sortable: false
},{
text: "Author",
dataIndex: 'author',
width: 100,
hidden: true,
sortable: true
},{
text: "Replies",
dataIndex: 'replycount',
align: 'center',
width: 70,
sortable: false
},{
id: 'last',
text: "Last Post",
dataIndex: 'lastpost',
width: 130,
renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
sortable: true
}],
renderTo: Ext.getBody()
});

var selMod = grid.getSelectionModel();
selMod.setSelectionMode( 'MULTI' );

// trigger the data store load
store.guaranteeRange(0, 199);
});