Ext.MessageBox.show({
title:'Messagebox Title',
msg: 'Are you sure want to delete?',
buttons: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"}
});
ExtJS 4 または 4.1 は、このコードをサポートしていません。ボタンは表示されません。
これを行う方法を見つけただけで、うまくいけば誰かに役立ちます。ご覧のとおり、ボタンを好きなように処理できます。フレームワークにはデフォルトで 4 つのボタンしかないことに注意してください。これは簡単には克服できない制限です。ソースには、0 から < 4 までハードコードされた複数のループがあります。
Ext.MessageBox.show({
title:'Messagebox Title',
msg: 'Are you sure want to delete?',
buttonText: {yes: "Some Button 1",no: "Some Button 2",cancel: "Some Button 3"},
fn: function(btn){
console.debug('you clicked: ',btn); //you clicked: yes
}
});
メソッド内のボタン構成は、表示するボタンを識別する番号を引数として取るため、メソッド show 内でこれを行うことはできません。できることは、メッセージ ボックスを事前に定義してから表示することです。
var win = Ext.create('Ext.window.MessageBox', {
width:300,
height: 100,
buttons: [
{text: 'My button 1'},{
text: 'My button 2'}
]
});
win.show({
title:'Messagebox Title',
msg: 'Are you sure want to delete?',
icon: Ext.Msg.QUESTION
});
次のコードを使用します。
Ext.MessageBox.show({
title:'Messagebox Title',
msg: 'Are you sure want to delete?',
buttonText: {
yes: 'Some Button 1',
no: 'Some Button 2',
cancel: 'Some Button 3'
}
});
それがあなたを助けることを願っています。
この解決策を試してください:
<script type="text/javascript">
(function () {
Ext.override(Ext.MessageBox, {
buttonText: { yes: "Sí", no: "No", cancel: "Cancelar" }
});
})();
</script>