Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default beforeRowSelect event makes selection

    beforeRowSelect event makes selection


    If I return false on a beforerowselect the selectevent isn't fired, but somehow it makes the selection. In the sample below getLastSelection returns the record wich I cancelled in beforeRowSelect. It also focusses the clicked row if it was a new selection.

    This behaviour is new in 4.1. I think it should not focus the clicked row and the clicked record should not be returned with getLastSelection.

    What I want is to cancel the selection (the previous row should remain focussed), but I also want to know the clicked row to procede later on with the selection.


    Code:
    Ext.onReady(function() {
        Ext.tip.QuickTipManager.init();
    
        // Store creation
        Ext.create('Ext.data.Store', {
            storeId: 'simpsonsStore',
            fields: ['name', 'email', 'phone'],
            data: { 'items': [
            { "name": "Lisa", "email": "lisa@simpsons.com", "phone": "555-111-1224" },
            { "name": "Bart", "email": "bart@simpsons.com", "phone": "555--222-1234" },
            { "name": "Homer", "email": "home@simpsons.com", "phone": "555-222-1244" },
            { "name": "Marge", "email": "marge@simpsons.com", "phone": "555-222-1254" }
            ]
            },
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'items'
                }
            }
        });
    
        var gridpanel = Ext.create('Ext.grid.Panel', {
            id: 'gridpanel',
            store: Ext.data.StoreManager.lookup('simpsonsStore'),
            title: 'A grid',
            multiSelect: true,
            columns: [
            { header: 'Name', dataIndex: 'name' },
            { header: 'Email', dataIndex: 'email', flex: 1 },
            { header: 'Phone', dataIndex: 'phone' }
            ]
        });
    
    
        gridpanel.getSelectionModel().on('beforeselect', function(selectionModel, record, index, options) {
    
            var lastSelected = gridpanel.getSelectionModel().getLastSelected();
            alert(lastSelected.data.name);
            return false;
            //alert('beforerowselect');
        });
    
        gridpanel.getSelectionModel().on('beforeselect', function(selectionModel, record, index, options) {
    
            var lastSelected = gridpanel.getSelectionModel().getLastSelected();
            alert(lastSelected.data.name);
            return false;
            //alert('beforerowselect');
        });
    
        gridpanel.getSelectionModel().on('select', function(selectionModel, record, index, options) {
            alert('rowselect');
        });
    
    
    
        var panel = Ext.create('Ext.panel.Panel',
        {
            height: '400',
            width: '400',
            border: true,
            title: 'click a row twice',
            renderTo: Ext.getBody(),
            items: [gridpanel]
        });
    
    });

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,108
    Vote Rating
    31
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    It has to do with multiSelect. In that case returning false in beforeSelect is not working. Even as returning false in the deselect is not working with selection mode MULTI

    Code:
    Ext.onReady(function() {
        Ext.tip.QuickTipManager.init();
    
        // Store creation
        var store = Ext.create('Ext.data.Store', {
            storeId: 'simpsonsStore',
            fields: ['name', 'email', 'phone'],
            data: { 'items': [
            { "name": "Lisa", "email": "lisa@simpsons.com", "phone": "555-111-1224" },
            { "name": "Bart", "email": "bart@simpsons.com", "phone": "555--222-1234" },
            { "name": "Homer", "email": "home@simpsons.com", "phone": "555-222-1244" },
            { "name": "Marge", "email": "marge@simpsons.com", "phone": "555-222-1254" }
            ]
            },
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'items'
                }
            }
        });
    
    
        var gridpanel = Ext.create('Ext.grid.Panel', {
            id: 'gridpanel',
            store: Ext.data.StoreManager.lookup('simpsonsStore'),
            title: 'A grid',
            multiSelect: true,
            columns: [
            { header: 'Name', dataIndex: 'name' },
            { header: 'Email', dataIndex: 'email', flex: 1 },
            { header: 'Phone', dataIndex: 'phone' }
            ]
        });
    
    
        gridpanel.on('deselect', function(selectionModel, record, index, options) {
    
             alert('deselect');
             return false;
            
        });
    
    
        gridpanel.on('beforeselect', function(selectionModel, record, index, options) {
    
            var lastSelection = gridpanel.getSelectionModel().getLastSelected();
    
            if (lastSelection) {
                alert(lastSelection.data.name);
                return false;
            }
          
        });
    
    
        var panel = Ext.create('Ext.panel.Panel',
        {
            height: '400',
            width: '400',
            border: true,
            title: 'click a row twice',
            renderTo: Ext.getBody(),
            items: [gridpanel]
        });
    
    });

  3. #3
    Sencha User ykey's Avatar
    Join Date
    Mar 2010
    Location
    USA
    Posts
    245
    Vote Rating
    27
    ykey has a spectacular aura about ykey has a spectacular aura about

      0  

    Default


    Pretty sure I am having the same problem with 4.0.7 (returning false in beforeselect is not working)

  4. #4
    Sencha User ykey's Avatar
    Join Date
    Mar 2010
    Location
    USA
    Posts
    245
    Vote Rating
    27
    ykey has a spectacular aura about ykey has a spectacular aura about

      0  

    Default


    I am thinking the MULTI select logic should be something more like this, otherwise you can reselect already selected rows and you cannot use allowDeselect

    Ext.selection.Model#selectWithEvent
    Code:
    Ext.override(Ext.selection.Model, {
    	selectWithEvent: function(record, e, keepExisting) {
    		var me = this;
    
    
    		switch (me.selectionMode) {
    			case 'MULTI':
    				if (e.ctrlKey && me.isSelected(record)) {
    					me.doDeselect(record, false);
    				} else if (e.shiftKey && me.lastFocused) {
    					me.selectRange(me.lastFocused, record, e.ctrlKey);
    				} else if (e.ctrlKey) {
    					me.doSelect(record, true, false);
    				} else if (me.isSelected(record) && !e.shiftKey && !e.ctrlKey && me.selected.getCount() > 1) {
    					me.doSelect(record, keepExisting, false);
    				} else if (!me.isSelected(record)) {
    					me.doSelect(record, false);
    				} else if (me.allowDeselect) {
    					me.doDeselect(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 and do NOT maintain existing selections
    				} else {
    					me.doSelect(record, false);
    				}
    				break;
    		}
    	}
    });

  5. #5
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    I'm going to move this thread to the bugs forum. I agree that returning false isn't working correctly for a grid with multiSelect enabled.

    This isn't new to 4.1 though, I can reproduce it with 4.0.7 as well.

  6. #6
    Sencha User
    Join Date
    Mar 2012
    Posts
    1
    Vote Rating
    0
    kaiton is on a distinguished road

      0  

    Default Select does not work 4.0.7

    Select does not work 4.0.7


    Hi,

    I got the same problem here with version 4.0.7

    What is the current status of this thread?

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar