Code:
var letterCombo = new Ext.form.ComboBox(
{
hiddenName:"formLetter"
,id:"letterComboId"
,fieldLabel:"Choose a Letter"
,store: dsLetter
,mode:'local'
,displayField:'name'
,valueField: 'formletterId'
,emptyText: "Please select a letter"
,triggerAction:'all'
,width:200
,forceSelection:true
,listeners: {select:function(thisCombo, letterRec, idx)
{
loadEmailBody(letterRec, null);
}}
,baseCls:"margin:20px"
});
var absCombo = new Ext.form.ComboBox(
{
hiddenName:"countyStateAbs"
,id:"abstractorComboId"
,fieldLabel:"Choose an Abstractor"
,store: dsAbsc
,mode:'local'
,displayField:'countyStateAbs'
,valueField: 'abscountyId'
,triggerAction:'all'
,emptyText: "Please select an abstractor"
,width:300
,forceSelection:true
,listeners: {
select:function(thisCombo, absRec, idx)
{
var theForm = thisCombo.ownerCt.form;
theForm.setValues(absRec.data);
loadEmailBody(null, absRec);
}}
,baseCls:"margin:20px"
});
var absWin = new Ext.Window(
{
layout: 'form'
,modal: true
,shadow: true
,width: 535
,height: 490
,closeAction:'hide'
,plain: false
,style:"background-color:white;"
,items:
{ xtype:"form"
,id: 'absForm'
,header:false
,labelWidth:143
,style:"padding:10px;background-color:white;"
,border:false
,hideBorders:true
,items:
[
{xtype:"hidden", name:"abscountyId"}
,{xtype:"hidden", name:"transactionId", id:"transIdFldId"}
,{xtype:"hidden", name:"today", id:"todayFldId"}
,letterCombo
,absCombo
,{xtype: "textfield"
,id:'absEmailId'
,fieldLabel:"Abstractor Email Address"
,width: 200
,name:"orderEmail"
}
,{xtype: "textfield"
,id:'subjectFldId'
,fieldLabel:"Subject"
,width: 352
,name:"subject"
}
,{xtype:"textarea"
,name:"emailBody"
,id:"emailBodyId"
,hideLabel:true
,width:500
,height:300
}
]
}
,buttons:
[
{text:"Send Abstract Request"
,name:"sendEmail"
,tooltip:"This will send the email AND assign the selected abstractor to the current trasnaction."
,handler: function()
{
// we also need to save the abstractor setting here- this will happen in the php
var theForm = absWin.getComponent('absForm').form;
var valsObj = theForm.getValues(false); // return obj
Ext.Ajax.request(
{
waitMsg: 'Sending abstract request...'
,url: 'sendAbsEmail.php'
,params: valsObj
,method: 'POST'
,failure:function(response,options){
Ext.MessageBox.alert('Warning','Trouble sending abstractor email...');
}
,success:function(response,options){
absWin.hide();
// ds.commitChanges();
var responseData = Ext.util.JSON.decode(response.responseText);
Ext.example.msg('Email sent','Abstract request email sent and<br>abstractor selected for this transaction', "");
}
});
}
}
,{text:'Cancel'
,tooltip:"This will close this window without doing anything." ,handler:function(){ absWin.hide();} }
,{text:'Save'
,tooltip:"This will assign the selected abstractor to the current trasnaction<br>(and will NOT send the email)."
,handler:function(e){ absWin.hide();} }
]
,listeners:
{activate: function(theWin)
{
var theAbsCombo = Ext.getCmp("abstractorComboId");
theAbsCombo.setValue(dsAbsc.getAt(0).data.countyStateAbs);
// this does set the correct string in the
// field but does NOT fire the select event, even tho the docs say it does.
// on this combo, the displayfield and valuefield are both the same, and I am setting
// it to one of the values in the store, yet that value doesn't get selected
// experiment- theAbsCombo.select(0, true);
}}
}
);
Now, here is the function I call to display the window. In this function, I apply a filter to the store in hopes that the absCombo will show my filtered data.