1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Vote Rating
    0
    Answers
    1
    elnaz is on a distinguished road

      0  

    Default Answered: how shuild I create selModel for grid inside of tab panel

    Answered: how shuild I create selModel for grid inside of tab panel


    create selModel for grid inside of tab panel

    I want to create selection Model for grid inside of tab panel ,but I don't know what should I do..



    for grid panel I have this code and it's work :

    initComponent: function() {
    Ext.apply(this, { selModel: Ext.create('Ext.selection.CheckboxModel') });
    this.callParent(arguments);
    },


    but for grid inside tab it doesn't work and I don't know How should it look like
    here is some part pf my tab panel



    extend: 'Ext.tab.Panel',
    alias:'widget.relation',
    width: 350,
    border: true,
    maxHeight:280,
    bodyBorder: false,
    fieldDefaults: {
    labelWidth: 75,
    msgTarget: 'side'
    },


    items: [{
    title: 'Account',
    xtype: 'container',
    items:[{
    align:'center',
    xtype:'gridpanel',
    store: 'StoreAccount',

    columns: [
    {header:'Method',dataIndex:'method', flex: 1,align:'center'},
    {header:'Information',dataIndex:'info', flex: 1,align:'center'},

    ]
    }]


    },{
    title: 'Activites',
    xtype: 'container',
    items:[{
    align:'center',
    xtype:'gridpanel',
    store: 'StoreAccount',
    columns: [
    {header:'Method',dataIndex:'method', flex: 1,align:'center'},
    {header:'Information',dataIndex:'info', flex: 1,align:'center'},

    ]
    }]





  2. Try adding multiSelect: true to your grid's viewconfig.
    http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Table-cfg-multiSelect

    *
    don't forget to mark this question as answered, too.

  3. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    Answers
    102
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I don't understand what you're trying to do . First, you should post code within CODE tags. Second, why not just put selType: 'cellmodel', in your grid config?

  4. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,974
    Vote Rating
    212
    Answers
    476
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    You might try in your grid configuration using the property of selType: 'checkboxmodel'.

    Also, your tabPanel's items array has xtype: 'container' with an items array containing your grids, but should be able to omit the container itself and just have the grid be the item itself in your tabPanel's items array.

    Also, in the future when you post code into the forum you should wrap the code in code tags using the # button in the toolbar above your post. That and indenting each block of code will make reading the code a little easier.

    Code:
    Ext.create('Ext.tab.Panel', {
        items: [{
            xtype: 'grid'
            , title: 'Tab Title'
            , store: store
            , columns: columns
            , selType: 'checkboxmodel'
        }]
    })
    See if that works for you.

  5. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Vote Rating
    0
    Answers
    1
    elnaz is on a distinguished road

      0  

    Default


    It works .Thanks ,but how can I choose 2 or more row ,since I can just select one row.

  6. #5
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,974
    Vote Rating
    212
    Answers
    476
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Try adding multiSelect: true to your grid's viewconfig.
    http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Table-cfg-multiSelect

    *
    don't forget to mark this question as answered, too.

  7. #6
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Vote Rating
    0
    Answers
    1
    elnaz is on a distinguished road

      0  

    Default


    Thanks but I don't know
    How should I put answered ?

  8. #7
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Vote Rating
    0
    Answers
    1
    elnaz is on a distinguished road

      0  

    Default


    I found that