I have built a system for my final year project. At one part, I have a list of contact table with check box to select the contact numbers, and I planned to add these selected phone numbers to recipient list without typing back the selected numbers into the list.
My problem is that I dont know how to transfer them to the list; I’m using EXTJs, and I have built a button to add to the list which is “add to recipient”.
Sorry for any grammar mistakes. 🙂
my code for check box
var check = new Ext.grid.CheckboxSelectionModel();
var grid = new Ext.grid.GridPanel({
store: myStore,
autoScroll:true,
sm:check,
listeners:{
'rowdblclick': onRowDoubleClick,
'rowclick': onRowClick
},
columns: [
{id:'sub',header: "Course", width: 30, dataIndex: 'Course'},
{header: "Matrix No", width: 30, dataIndex: 'MatrixNo'},
check,
{header: "Phone No", width : 30, dataIndex: 'PhoneNo'},
],
.
.
.
code for recipient part
Ext.onReady(function(){
Ext.QuickTips.init();
.
.
.
.
Ext.form.Field.prototype.msgTarget = 'side';
var bd = Ext.getBody();
var tabs = new Ext.FormPanel({
labelWidth: 75,
border:false,
method: 'post',
width: 600,
url: './php/send.php',
items: {
xtype:'tabpanel',
activeTab: 0,
defaults:{autoHeight:true, bodyStyle:'padding:15px'},
items:[{
layout:'form',
defaults: {width: 475},
defaultType: 'textfield',
items: [{
.
.
.
},{
fieldLabel: 'Recipient',
name: 'recipient',
layout:'column',
height:20,
allowBlank:false,
id:'recipient',
}]
}]
.
.
.
buttons: [{
text: 'Add to Recipient',
handler: function (){
.
.
.
);
}
})
}
}]
You can get an array of selected records via
check.getSelected()wherecheckis your CheckBoxSelectionModel.If I understood correctly, you want to generate a simple string of recipients’ emails to send them messages. If that is the case (e.g.
'recipient'in your example is a plain text field), then it will be something like: