View Full Version : [CLOSED] Gridpanel selected items in cardlayout

Jan 21, 2014, 12:34 PM
I have a Gridpanel in a cardlayout with checkboxselectionmodel.

When i change selected items in a directevent and do an updateSelection() the hasSelection() always returns false unless i activate the gridpanel in the cardlayout.

This was working fine without activating the Gridpanel in the cardlayout but after updating from SVN it does not work anymore.

I have tried deferredrender = false in the cardlayout layoutconfig.

It is like the gridpanel won't update the selection until the panel has been activated at least once.

Any help appreciated.


Jan 22, 2014, 3:09 AM
Hi @Fergus,

The background is the following.

No items are available for selection until a GridView's ViewReady event fires.

The ViewReady event fires on rendering and layouting of the GridPanel. Yes, DeferredRender="false" helps to render the GridPanel in a hidden card immediately, but it doesn't force layouting. I think layouting can be properly done on first activation only. So, no layout => no ViewReady event => no selection. It is why the hasSelection method returns false.

You said that it worked previously. I would say it was rather a defect.

As a solution I can suggest the following:

var hasSelectionExtended = function(sm) {
if (sm.view.viewReady) {
return sm.hasSelection();
} else {
return !Ext.isEmpty(sm.selectedData);