PDA

View Full Version : Accessing component from one js to another js



vms.saran
10 Aug 2010, 12:30 AM
hi this is the pbm i am experiencing now.. i will provide u with full code....
Can any one plz help me

test.js

Extensive.grid.ButtonClickTab = Ext.extend(Ext.grid.RowSelectionModel, {
width: 125,
sortable: false,
dataIndex: 0, // this is needed, otherwise there will be an error
menuDisabled: true,
fixed: true,
id: 'buttonClick',
header:'Upload',
// header:'File Upload',
initEvents: function()
{
Extensive.grid.ButtonClickTab.superclass.initEvents.call(this);
this.grid.on('cellclick', function(grid, rowIndex, columnIndex, e){
if(columnIndex==grid.getColumnModel().getIndexById('buttonClick')) {
var win;
var fp = new Ext.FormPanel({
//renderTo: 'fi-form',
fileUpload: true,
width: 500,
frame: true,
title: 'File Upload Form',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
allowBlank :false,
id :'file',
inputType :'file',
name :'myFile',
fieldLabel :'Upload',
anchor :'95%',
required :true,
autoShow :true,
width: 400,
labelWidth: 150,
xtype :'textfield'
}],
buttons: [{
text: 'Clear',
handler: function(){

}
},{
text: 'Upload',
id : '_UploadButtonjs',
handler: function(){
fp.getForm().reset();
}
},{
text: 'Close',
handler: function(){
win.hide();
win.destroy();
win.close();
}
}]
});
if(!win){
win = new Ext.Window({
layout:'fit',
modal:true,
width:500,
autoHeight : true,
autoScroll:true,
closeAction:'hide',
closable : false,
plain: true,
items: [ fp ]

});
}
win.show();
}
if(columnIndex==grid.getColumnModel().getIndexById('deleter')) {
var record = grid.getStore().getAt(rowIndex);
grid.getStore().remove(record);
grid.getView().refresh();
}
});
},
renderer: function(v, p, record, rowIndex){
return '<div class="extensive-button" style="width: 15px; height: 16px;"></div>';
}
});

how do i access the upload button in another file sample.js

vms.saran
10 Aug 2010, 12:44 AM
hi this is the pbm i am experiencing now.. i will provide u with full code....
Can any one plz help me





test.js

Extensive.grid.ButtonClickTab = Ext.extend(Ext.grid.RowSelectionModel, {
width: 125,
sortable: false,
dataIndex: 0, // this is needed, otherwise there will be an error
menuDisabled: true,
fixed: true,
id: 'buttonClick',
header:'Upload',
// header:'File Upload',
initEvents: function()
{
Extensive.grid.ButtonClickTab.superclass.initEvents.call(this);
this.grid.on('cellclick', function(grid, rowIndex, columnIndex, e){
if(columnIndex==grid.getColumnModel().getIndexById('buttonClick')) {
var win;
var fp = new Ext.FormPanel({
//renderTo: 'fi-form',
fileUpload: true,
width: 500,
frame: true,
title: 'File Upload Form',
autoHeight: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
allowBlank :false,
id :'file',
inputType :'file',
name :'myFile',
fieldLabel :'Upload',
anchor :'95%',
required :true,
autoShow :true,
width: 400,
labelWidth: 150,
xtype :'textfield'
}],
buttons: [{
text: 'Clear',
handler: function(){

}
},{
text: 'Upload',
id : '_UploadButtonjs',
handler: function(){
fp.getForm().reset();
}
},{
text: 'Close',
handler: function(){
win.hide();
win.destroy();
win.close();
}
}]
});
if(!win){
win = new Ext.Window({
layout:'fit',
modal:true,
width:500,
autoHeight : true,
autoScroll:true,
closeAction:'hide',
closable : false,
plain: true,
items: [ fp ]

});
}
win.show();
}
if(columnIndex==grid.getColumnModel().getIndexById('deleter')) {
var record = grid.getStore().getAt(rowIndex);
grid.getStore().remove(record);
grid.getView().refresh();
}
});
},
renderer: function(v, p, record, rowIndex){
return '<div class="extensive-button" style="width: 15px; height: 16px;"></div>';
}
});



how do i access the upload button in another file sample.js