PDA

View Full Version : how to get grid selections in abstract form



mayurid
3 Sep 2010, 3:57 AM
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
function handleActivate(tab) {
var tabid = tab.title;
document.getElementById('txt_tab').value = tabid;
}
var search_tab = new Ext.Panel({
renderTo: document.body,
title: 'search',
id: 'search_id',
collapsible: true,
layout: 'fit',
//frame:true,
width: '100%',
defaults: {
height: 200,
labelWidth: 100
},
items: [{
xtype: 'form',
id: 'search_form',
border: false,
url: 'grid_search_back.php',
items: [{
xtype: 'tabpanel',
border: false,
activeTab: 0,
height: 200,
items: [{
title: 'Basic search',
listeners: {
activate: handleActivate
},
id: 'basic_id',
columnWidth: .5,
layout: 'column',
layout: 'form',
bodyStyle: 'padding:5px',
frame: false,
items: [{
xtype: 'textfield',
id: 'types',
name: 'types',
fieldLabel: 'types'
},
{

xtype: 'textfield',
id: 'category_name',
name: 'category_name',
fieldLabel: 'category_name'
}]
},
{
title: 'Advanced Search',
listeners: {
activate: handleActivate
},
layout: 'form',
id: 'advanced_id',
bodyStyle: 'padding:5px',
frame: false,
items: [{
xtype: 'textfield',
id: 'adv_regno',
name: 'adv_regno',
fieldLabel: 'Reg. no'
},
{
xtype: 'textfield',
id: 'company',
name: 'company',
fieldLabel: 'Company'
}]
}]




}],
buttons: [{
text: 'Search',
handler: function() {

var store1 = Ext.StoreMgr.get('mystore');
//alert(store1);
var tab23 = document.getElementById('txt_tab').value;
if (tab23 == 'Basic search') {
store1.baseParams.types = Ext.getCmp('types').getValue();

store1.baseParams.category_name = Ext.getCmp('category_name').getValue();
store1.baseParams.task = 'basic_search'; //here u set as advanced
store1.load({
params: {
task: 'basic_search',
types: Ext.getCmp('types').getValue(),
category_name: Ext.getCmp('category_name').getValue()
}
});


}
else {
store1.baseParams.adv_regno = Ext.getCmp('adv_regno').getValue();
store1.baseParams.company = Ext.getCmp('company').getValue();
store1.baseParams.task = 'advanced_search'; //here u set as advanced
store1.load({
params: {
task: 'advanced_search',
adv_regno: Ext.getCmp('adv_regno').getValue(),
company: Ext.getCmp('company').getValue()
}
});


}
}


},
{
text: 'Cancel',
handler: function() {
Ext.getCmp('search_form').getForm().reset();
}
}]
}]

});
//Abstract Grid
new MyApp.newgrid({
id: 'services_grid',
renderTo: Ext.getBody()
});
//Abstract Form
new MyApp.mass_update_form({
id: 'update_form',
//this is button in another form :
onOkBtn: function() {
here i want grid Selections in grid i have row selection model(check box column)below is not working
var grid_get = services_grid.getSelectionModel();
},
renderTo: Ext.getBody()
});
});

Condor
3 Sep 2010, 4:30 AM
There is no variable 'services_grid'! There is only a component with id:'services_grid'.

Use:

var selModel = Ext.getCmp('services_grid').getSelectionModel();