PDA

View Full Version : [CLOSED] Issue with Ext.view.View moving from 4.0.2a to 4.0.7 [with a very poor fix]



Gareth Bult
29 Nov 2011, 6:43 AM
Probably not a patch that will make it's way into the next release, but the fact that it fixes the issue should help to demonstrate the problem. I'm creating a "view" like so;

var view = Ext.create('Ext.view.View', {
id : module+'-view',
store : Ext.data.StoreManager.lookup(store),
tpl : mod_lib.mod_view_tpl,
itemSelector: 'li.portlet-wrap',
singleSelect: true,
multiSelect : false,
autoScroll : true
});I then populate the view and "select" (or highlight) the first object with;

view = Ext.getCmp(module+'-view');
view.select(0);
This works file on 4.0.2 but falls over on 4.0.7.

Changes required to make it work, first I do this to select the first object;

view = Ext.getCmp(module+'-view');var record = store.getAt(0);
view.select(record,false,true);
i.e. passing a record number / index no longer seems to work. Then I need to add a couple of checks to the main library;

Ext.selection.DataViewModel.onSelectChange:
if(isSelected) needs to be protected with an if(view) as it appears me.view "can" be undefined.

Ext.view.AbstractView.select:
this.selModel "can" be undefined, however in such an instance this.getSelectionModel() seems to work.

select: function(records, keepExisting, suppressEvent) {
if(this.selModel)
this.selModel.select(records, keepExisting, suppressEvent);
else this.getSelectionModel().select(records, keepExisting, suppressEvent);
},
I'm guessing there's a way around this by approaching it differently, if someone could point me in the right direction I'd be most grateful.

mitchellsimoens
29 Nov 2011, 3:04 PM
Looking at our latest code it looks like select() is able to receive an index once again.

Gareth Bult
29 Nov 2011, 3:58 PM
As it happens I've found a few other compatibility issues between 4.0.2a and 4.0.7 so I've downgraded my code to the 4.0.2a base and back-ported a couple of fixes I wanted from 4.0.7.

Did you want any of the new code testing?
(if so do you have a download location?)

In particular panel resizing with my portal based app breaks, for some reason you can shrink a panel no problem, but any given resize operation can only increase the size of a panel by 11 pixels .. very strange and reverting the library fixes it.