2013-10-23 41 views
0

我有一個InputText,我希望能夠在選擇InputText時打開頁面,然後按例如鍵:F9。Oracle ADF:從按下InputText上的某個鍵打開頁面

到目前爲止,我有一個JavaScript,它監聽keyPress並且正在工作。同時,我可以顯示一個彈出窗口,但現在當按下該鍵,我想轉換到另一個頁面:

接下來我有代碼:

function handleKeyEvent(evt) { 
    var _keyCode = evt.getKeyCode(); 
    if (_keyCode == AdfKeyStroke.F9_KEY){ 
     //Do Something ... 
      showPopup(evt) 
     evt.cancel(); 
    } 
} 


function showPopup(event) 
{ 
    event.cancel(); 
    var source = event.getSource(); 
    var popupId = "p1"; 
    var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId); 


if (!popup.isPopupVisible()) 
{ 
    var hints = {}; 
    hints[AdfRichPopup.HINT_LAUNCH_ID] = source.getClientId(); 
    hints[AdfRichPopup.HINT_ALIGN_ID] = source.getClientId(); 
    hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START; 

    popup.show(hints); 
} 
} 

如何才能做到這一點?

感謝 問候

+0

你有沒有嘗試過的東西? –

+0

增加了更多的信息問題 – mmm

回答

0

您可以更改handleEventKey函數內部放置在location.href這樣

function handleKeyEvent(evt) { 
evt.cancel(); 
var _keyCode = evt.getKeyCode(); 
if (_keyCode == AdfKeyStroke.F9_KEY){ 
    //Change the page 
    document.location.href = newUrl; 
} 
} 
0

的問題是你怎麼想瀏覽到此頁,什麼是您的周圍?

如果您只需打開一些外部URL,那麼您可以使用Amr(location.href)提供的解決方案。

但是,當您需要導航到任務流中的另一個視圖或應用程序中的其他頁面或執行某個操作時。您需要使用行動事件隊列。

要從javascript獲得支持bean,您必須使用serverListener組件。 然後,您可以像這樣從javascript將消息路由到您的聽衆:
帶附加參數的示例param1傳遞和serverListener附加到ID爲cmp1的組件。 (不要忘了clientComponent=true選項添加到這個組件。

var evenSource = AdfPage.PAGE.findComponent("cmp1"); 
var paramValue = "parameter value"; 
AdfCustomEvent.queue(eventSource, "uploadProgress", {param1: paramValue1}, true); 

這樣,您將您的路由事件到服務器,然後,你可以做任何你從你的bean導航的長期需要。

你可以得到更多的細節here
this sample可能是有用的。

相關問題