PDA

View Full Version : Missing ) in parenthetical



oroma
5 May 2009, 8:18 AM
I've had a look round the site, and while there are a couple of threads with similar headers, no one really says what causes this error.

This is my code:




// This will call function to generate panel
var fileDownloadManagerFunction = function(){

var msg = function(title, msg){
Ext.Msg.show({
title: title,
msg: msg,
minWidth: 200,
modal: true,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
};
var stuff= new Ext.data.SimpleStore({
fields: ['id', 'fruitname'],
data:[
['apple', 'apples'],
['pear', 'pears']
]
});

var rp =
new Ext.FormPanel({
labelWidth: 75,
frame:true,
title: 'Generate Data',
bodyStyle:'padding:5px 5px 0',

items: [
{
xtype: 'combo',
name: 'labels',
fieldLabel: 'label',
mode: 'local',
store: stuff,
displayField: 'Name',
width:300
},
{
xtype: 'radio',
fieldLabel: 'Type',
name: 'Type',
boxLabel: 'apple'
},
{
xtype: 'radio',
hideLabel: false,
labelSeparator: '',
name: 'Type',
boxLabel: 'pears'
}
],


buttons: [
{
text: 'Submit',
handler: function(){
if(rp.getForm().isValid()){
rp.getForm().submit({
url: 'myURl',
waitMsg: 'Generating...',
success: function(rp, o){

// create hidden target i-frame
Ext.DomHelper.append(document.body, {
tag: 'iframe',
id:'downloadIframe',
frameBorder: 0,
width: 0,
height: 0,
css: 'display:none;visibility:hidden;height:1px;',
src: this.url
});

Ext.MessageBox.alert('Success');
var result = Ext.decode(o.response.responseText);
msg('Success', result.message);

},
failure:function(rp, o){
msg('Failure', 'Unable to create report');
}
});
}
}
},
{
text: 'Reset',
handler: function(){
rp.getForm().reset();
}
}
]
});
return{
getDownloadPanel: function(){
return rp;
}
}
};


The other threads seem to point at a syntax error of some sort. I've looked through this, and can't seem to spot anything. Perhaps a pair of fresh eyes then?

talshadar
13 May 2009, 6:10 AM
I'm not seeing anything either. My suggestion is to simplify the whole thing. Comment out sections until it works. IE: The buttons - comment out the handler parts etc. Good luck.

Maharshi
15 May 2009, 1:42 PM
Hi,
Ignore this if you have already noticed it.

displayField : 'Name' , this should match with the fields array in SimpleStore, i see 'fruitname' there.

Hope this helps