PDA

View Full Version : "Email All" button for a store of people, all with an email field



alex9311
7 Sep 2012, 1:00 PM
Hey all,

I'm a noob at extjs so sorry if this question is too broad. I have a store full of people, each of which have a name, phone number, email, etc etc. The data is all displayed in a grid. In the grid row for the email field I made it so the email is displayed as a mailto link (which works). Now I'm looking to put a button under the grid which is a mailto for everyone in the grid (or store, same data). Does that make sense?

Thank you for any help

alex9311
10 Sep 2012, 3:10 PM
I figured out how to do this, here's my controller function


mailAll:function(button){
var port = button.up('viewport'),
grid = port.down('userlist'),
panel = port.down('userpanel'),
label = panel.down('label'),
emailList = 'mailto:?bcc=';
grid.store.each(function(record, index){
emailList = emailList + record.get('EMail') + ', ';
});
//label.setText(emailList);
window.open(emailList);
},