0

sencha touch 2.1 のテキストフィールドにピッカーフィールドで選択したテキストを表示しようとしています。コードに問題はありませんが、まだ機能していません。以下は私のコードです。実用的なソリューションを提供してください。

{
    xtype : 'textfield ',
    id : 'PacingMode ',
    style : 'background - color: #585858;',
    top : '13.5%',
    usePicker : true,
    left : '20%',                                                                             
    width : '5%',                                                                         
    listeners : {
          'focus' : function(a,e, eOpts) {                                                                                                                             
                console.log("show caling");
                document.activeElement.blur();
                if (!this.picker) {
                this.picker = Ext.Viewport.add({

    xtype: 'picker',
    id: 'pacingModePickerfield',
    useTitles: true,
    slots: [{
            name: 'quantity',
            title: 'Pacing Mode',
            data: modelMgr.slotsdata1,
            valueField: 'value',
        }
    ],
    doneButton: {
        listeners: {
            // when the done button is tapped, set the value
            tap: function (button, event, eOpts) {

                var sel = document.getElementById("pacingModePickerfield");
                var text_value = sel.options[sel.selectedIndex].text;
                Ext.getCmp('PacingMode').setValue(text_value);

            }
        }
    }

});

}
this.picker.show();
},
change: function (a, e, newValue, eOpts) {
    sendValueSetRequest(this.id);

},
}
4

3 に答える 3

3

ピッカーから値を取得するには、フレームワークを使用する必要があります。

tap: function(button, event, eOpts) {      
    var val = Ext.getCmp("pacingModePickerfield").getValues().quantity;                                                                                                                                                                                                                                                      
    Ext.getCmp('PacingMode').setValue(val);                                                                                                                         
}
于 2013-05-03T09:27:44.183 に答える
0

これは私の作業コードです:

doneButton : {

   listeners : {
            tap : function(button,event,eOpts) {
                var selectedUpperSensorValue = Ext.getCmp('upperSensorPickerfield').getValue()['Upper Sensor'];
                sendSetPendingRequest("UpperSensor",selectedUpperSensorValue);
         }
    }
}
于 2013-05-06T06:21:57.553 に答える