현재 팝업 패널은 그러나 당신은 클라이언트 핸들러 또는 서버 핸들러를 사용하여 다른 이벤트에 팝업을 만들 수 있습니다 사용자 정의 패널을 만들 수 있습니다 제대로 작동하지 않습니다.
다음은 클라이언트 처리기를 사용하여 클릭 이벤트에서 트리거 된 팝업의 데모를 보여주는 대략적인 코드입니다.
function doGet(){
var app = UiApp.createApplication();
app.add(createMaskPanel_());//this is used to make poup panel modal
var mainPanel = app.createVerticalPanel();
app.add(mainPanel);
var btn = app.createButton('Open poup');
mainPanel.add(btn);
//Makke a panel for poup and add your popup elements
var popup = app.createVerticalPanel().setId('popup').setVisible(false)
.setStyleAttributes(
{'position': 'fixed',
'border' : '1px solid black',
'top' : '40%',
'left' : '43%',
'width' : '150',
'height':'150',
'zIndex' : '2'});
popup.add(app.createTextBox());
popup.add(app.createButton('Close').addClickHandler(app.createClientHandler().forTargets([app.getElementById('mask'), popup]).setVisible(false)));
app.add(popup);
btn.addClickHandler(app.createClientHandler().forTargets([app.getElementById('mask'), popup]).setVisible(true));
return app;
}
function createMaskPanel_(){ //Called when the setting UI loads, initially it will be invisble. id needs to be made visible
//by accessing its id "mask"
var app = UiApp.getActiveApplication();
var mask = app.createVerticalPanel().setId('mask').setSize('100%', '100%') //maskPanel to mask the ui
.setStyleAttributes({
'backgroundColor' : '#f4f4f4',
'position' : 'fixed',
'top' : '0',
'left' : '0',
'zIndex' : '1',
'opacity' : '0.5'}).setVisible(false);
//Added a dummy element so that it spans to whole window.
//don't know why but it works
mask.add(app.createLabel('SBC Technology')
.setStyleAttribute('color', '#f4f4f4')
.setStyleAttribute('opacity', '0.5'));
return mask;
}
고마워요! 나는 그것을 나의 신청에서 명확히 시도 할 것이다. –
@Waqar Ahmad- 안녕하세요, 아주 멋진 코드입니다! 자동으로 텍스트 상자의 키보드 포커스를 '팝업'에 자동 설정할 수있는 아이디어가 있습니까? 나는 성공적인 시도없이 다른 접근법을 시도했다 ... –
@Sergeinsas 안녕하세요, 나는 또한 자동 초점을 사용하여 성공적이지 않았으며, 어떤 해결 방법도 보이지 않습니다. 이슈 트래커 http://goo.gl/d4FDY에서 관련 문제를 볼 수 있습니다. –