PDA

View Full Version : Changing ignoreRightMouseSelection configuration of Ext.selection.rowModel at runtime



arnoldvillasanta
11 Nov 2014, 11:03 AM
Hi,

I have a SIMPLE/MULTI Select Datagrid in which I want to coordinate the methods of itemContextMenu and RightMouseSelection together.

I want to achieve the following scenario:
1. When user selects one row at a time:
The user must be able to use the right-mouse-click event to fire both row selection and context menu events asynchronously.

2. When user selects 2 or more rows:
The user must be able to left-mouse-click 2 or more rows then right-mouse-click to fire the contextmenu event.


So far, Item 1 is achievable when ignoreRightMouseSelection config is set to false on compile time.

For Item 2 however, the ignoreRightMouseSelection config must be set to 'true' on run-time so that previous selections will not be lost.

My question is what's the shortest code to achieve the scenario.
I'm looking for a method that goes like:



onRowModelBeforeSelect: function(rowmodel, record, index, eOpts) {
if(rowmodel.getCount() > 1) {
// rowmodel.changeConfigInstance({ignoreRightMouseSelection: true})
} else {
// rowmodel.changeConfigInstance({ignoreRightMouseSelection: false})
}
}



Thanks in advance...

joel.watson
13 Nov 2014, 2:58 PM
Hi Arnold--

Can you share the configuration for your grid? I've come across questions like this before, but want to make sure we're starting from the same page :)

If possible, could you post a fiddle (https://fiddle.sencha.com) with a test case of the issue?

Thanks!