PDA

View Full Version : how shuild I create selModel for grid inside of tab panel



elnaz
11 Aug 2011, 1:29 PM
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'},

]
}]

jay@moduscreate.com
11 Aug 2011, 2:58 PM
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?

slemmon
11 Aug 2011, 3:05 PM
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.


Ext.create('Ext.tab.Panel', {
items: [{
xtype: 'grid'
, title: 'Tab Title'
, store: store
, columns: columns
, selType: 'checkboxmodel'
}]
})

See if that works for you.

elnaz
12 Aug 2011, 12:01 AM
It works .Thanks ,but how can I choose 2 or more row ,since I can just select one row.

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

* (http://docs.sencha.com/ext-js/4-0/#/api/Ext.panel.Table-cfg-multiSelect) don't forget to mark this question as answered, too. ;)

elnaz
12 Aug 2011, 4:58 AM
Thanks but I don't know
How should I put answered ?

elnaz
12 Aug 2011, 5:03 AM
I found that :D