1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    72
    Answers
    2
    Vote Rating
    4
    ragecf is on a distinguished road

      0  

    Default Answered: Enable Text Selection By a button

    Answered: Enable Text Selection By a button


    Hi All,

    Happy new year!

    I wanted to enable/disable textselection by a button.

    Code:
    Ext.Create('Ext.grid.Panel', {
    ......... viewConfig: {
    enableTextSelection: false
    }, bbar: [
    text: '', iconCls: 'icon-enable-selection', toolTip: 'Enable Text Selection', enableToggle: true, handler: this.enableSelection,
    scope: this ]
    }; enableSelection: function(btn, state) {
    //how to set the enableTextSelection to true and make it effective?
    }
    Thanks.

  2. See if this helps. Worked for me in Firefox.

    Code:
    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'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
        , tbar: [{
            text: 'Enable Selection'
            , enableToggle: true
            , toggleHandler: function (btn, pressed) {
                var v = btn.up('grid').view.el;
                
                v.selectable();
            }
        }]
    });

  3. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    72
    Answers
    2
    Vote Rating
    4
    ragecf is on a distinguished road

      0  

    Default I did a test.

    I did a test.


    I did a test:

    Code:
    grid = Ext.create('Ext.grid.Panel', {
    ...... viewConfig: {
    stripeRows: true, enableTextSelection: false
    }, tbar: Ext.create('Ext.toolbar.Toolbar', {
    items: [{
    text: '', handler: this.onEnableSelection, scope: this, tooltip:'Enable Text Selection', enableToggle: true
    }]
    })
    } onEnableSelection = function(btn) { grid.view.normalView.stripeRows = btn.pressed; // This works fine. grid.view.normalView.enableTextSelection = btn.pressed; // This can not work. How to modify? grid.view.refresh(); }

  4. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    See if this helps. Worked for me in Firefox.

    Code:
    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'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
        , tbar: [{
            text: 'Enable Selection'
            , enableToggle: true
            , toggleHandler: function (btn, pressed) {
                var v = btn.up('grid').view.el;
                
                v.selectable();
            }
        }]
    });

  5. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    72
    Answers
    2
    Vote Rating
    4
    ragecf is on a distinguished road

      0  

    Default It's great.

    It's great.


    Thanks a lot.

    And a little change in my code:

    Code:
            , toggleHandler: function (btn, pressed) {
                var v = btn.up('grid').view.normalView.el;     //because enableLocking is true in my code
    
    if (pressed) {
    v.selectable();
    } else { v.unselectable(); }
    }

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    72
    Answers
    2
    Vote Rating
    4
    ragecf is on a distinguished road

      0  

    Default


    Quote Originally Posted by slemmon View Post
    See if this helps. Worked for me in Firefox.

    Code:
    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'
            }
        }
    });
    
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name' },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        renderTo: Ext.getBody()
        , tbar: [{
            text: 'Enable Selection'
            , enableToggle: true
            , toggleHandler: function (btn, pressed) {
                var v = btn.up('grid').view.el;
                
                v.selectable();
            }
        }]
    });

    Can not work in chrome and ie8 (winxp)

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi