Sencha panel에 서버에서 받은 정보를 화면 구성시 출력하기

2024. 10. 1. 11:22Javascript/Sencha

{
    xtype: 'panel',
    bodyStyle: 'background-color:black',
    listeners: {
        afterrender: function(panel) {
            Ext.Ajax.request({
                url: '/test/abc',
                success: function(response) {
                    let abc = Ext.decode(response.responseText);
                    let html = '<div style="font-weight: bold; height: 50px; display: flex; align-items: center; color: white; cursor: pointer">'+ abc.name +'('+ abc.tel +')</div>';
                    panel.update(html);
                },
                failure: function(response) {
                    console.log('Failed to fetch data from server', response.status);
                }
            });
        }
    }
},