Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', 'http://dev.sencha.com/extjs/5.0.0/examples/ux/');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.util.*',
'Ext.ux.form.SearchField',
'Ext.selection.CheckboxModel'
]);
Ext.onReady(function(){
// Allow deselecting the only selected record in MULTI mode with a simple click.
// Note that this will only happen when allowdeselect is true
Ext.override( Ext.selection.Model, {
selectWithEvent: function(record, e, keepExisting) {
var me = this;
switch (me.selectionMode) {
case 'MULTI':
if (me.isSelected(record)) {
me.doDeselect(record, false);
} else if (e.shiftKey && me.lastFocused) {
me.selectRange(me.lastFocused, record, e.ctrlKey);
} else if (!me.isSelected(record)) {
me.doSelect(record, true, false);
// Mod Start
} else if (me.isSelected(record) && !e.shiftKey && !e.ctrlKey && me.selected.getCount() == 1 && me.allowDeselect) {
me.doDeselect(record, false);
// Mod End
} else if (me.isSelected(record) && !e.shiftKey && !e.ctrlKey && me.selected.getCount() > 1) {
me.doSelect(record, keepExisting, false);
} else {
me.doSelect(record, false);
}
break;
case 'SIMPLE':
if (me.isSelected(record)) {
me.doDeselect(record);
} else {
me.doSelect(record, true);
}
break;
case 'SINGLE':
// if allowDeselect is on and this record isSelected, deselect it
if (me.allowDeselect && me.isSelected(record)) {
me.doDeselect(record);
// select the record...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.