{"size": 3303, "ext": "js", "max_stars_repo_path": "demos/msg/src/MessageBox.js", "max_stars_repo_name": "msgimanila/EXT-React-MSG", "max_stars_repo_stars_event_min_datetime": "2018-08-29T15:23:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-30T07:46:28.000Z", "max_issues_repo_path": "demos/msg/src/MessageBox.js", "max_issues_repo_name": "msgimanila/EXT-React-MSG", "max_issues_repo_issues_event_min_datetime": "2018-08-21T22:44:33.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-11T21:08:29.000Z", "max_forks_repo_path": "demos/msg/src/MessageBox.js", "max_forks_repo_name": "msgimanila/EXT-React-MSG", "max_forks_repo_forks_event_min_datetime": "2018-08-08T17:12:19.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-11T10:00:49.000Z"}
{"max_stars_count": 94, "max_issues_count": 49, "max_forks_count": 46, "avg_line_length": 36.2967032967, "max_line_length": 129, "alphanum_fraction": 0.3424159855}
import React, { Component } from 'react';
import { reactify } from '@sencha/ext-react-modern';
var Container = reactify('Container');
var Button = reactify('Button');
//var Dialog = reactify('Dialog');
const Ext = window.Ext;

export default class MessageBox extends Component {


    render() {

        return (
            <Container layout="fit" padding={10} fullscreen>

                    <Button handler={() =>

                    {
console.dir(Ext.Msg)

var myPanel = Ext.ComponentQuery.query('button[text="No"]');
console.log(myPanel)
                            Ext.Msg.show({
                                title: 'XXX-XX-XX',
                                listeners: {
                                    show: function(mb) {
                                        console.log('a')
                                        console.log(mb)
                                        var b = Ext.ComponentQuery.query('button[cls="mjg"]');
                                        //var b = Ext.ComponentQuery.query('#TEST_NOT_SAVE');


                                        var btn = b[0]
                                        console.dir(btn)
                                        console.log(btn.focusCls)
                                        console.log(btn.getCls())
                                        console.log(btn.setCls('x-focused'))
                                        console.log(btn.getCls())
                                        //mb.setFocus(b[0])
                                        //mb.setDefaultFocus('button[text="Not Save"]')

                                        //b[0].setFocus()
console.log(b)
                                    }
                                },
                                message: 'description',
                                icon : Ext.MessageBox.QUESTION,
                                defaultFocus: 'button[text="No"]',
                                //buttons: Ext.MessageBox.YESNOCANCEL,
                                buttons: {
                                    'SAVE' :{text: 'Save', id: 'TEST_SAVE', height: '40px', width: '50%', action: 'save'},
                                    'NOT_SAVE' :{text: 'Not Save', cls: 'mjg', id: 'TEST_NOT_SAVE', height: '40px', width: '50%'}
                               },




                                //defaultFocus: 'button',
                                fn: function(btn) {
                                    console.log(btn)
                                    if (btn === 'yes') {
                                        console.log('Yes pressed');
                                    } else if (btn === 'no') {
                                        console.log('No pressed');
                                    } else {
                                        console.log('Cancel pressed');
                                    }
                                }
                            })

                        }

                    } text="Show Message Box"/>

            </Container>
        )
    }

    showDialog = () => {
        this.setState({ showDialog: true });
    }

    onOk = () => {
        this.setState({ showDialog: false });
    }

    onCancel = () => {
        this.setState({ showDialog: false });
    }

}