0

最終年度のプロジェクトのシステムを構築しました。ある部分では、連絡先番号を選択するためのチェックボックスを備えた連絡先テーブルのリストがあり、選択した番号をリストに入力し直さずに、これらの選択した電話番号を受信者リストに追加することを計画しました。

私の問題は、それらをリストに転送する方法がわからないことです。私はEXTJを使用しており、「受信者に追加」というリストに追加するボタンを作成しました。

文法上の誤りがありましたら申し訳ありません。:)

チェックボックスの私のコード

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'},

    ],
      .
      .
      .

受信者部分のコード

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 (){
            .
                        .
                        .
                 );
              }
           })
        }
        }]
4

1 に答える 1

0

CheckBoxSelectionModelcheck.getSelected()がどこにあるかを介して、選択したレコードの配列を取得できます。check

私が正しく理解していれば、受信者の電子メールの単純な文字列を生成して、メッセージを送信する必要があります。その場合(たとえば'recipient'、例ではプレーンテキストフィールド)、次のようになります。

var recs = check.getSelected(),  // gives you an array of checked records in grid
    recipients = []; 

for(var i = 0, len = check.length; i < len; i++) {
    // build recipient string array
    recipients.push(recs[i].get('email')); // get all necessary fields from the record
}

recipientField.setValue(recipients.join(','));
// the field will contain a string like "amy@mail.org,john@mail.org,lucy@mail.org..."
于 2012-06-19T19:52:24.637 に答える