2013-11-14 17 views
0

我做了一個Jira servlet來執行一個問題的搜索,但我希望能夠爲該搜索添加一個過濾器,所以我需要能夠獲取文本作爲參數在我執行搜索之前。Jira中的文本字段的對話窗口serlvet

有沒有一種方法讓我做到這一點,當按下servlet按鈕時彈出text fieldOK對話框,並且在按下上述按鈕之後執行請求,並顯示一個空字符串或當前字符串作爲參數?

實際上,在執行請求之前動態設置參數的任何方式都可能有所幫助。

回答

3

聽起來你想要使用InlineDialog模式。例如,請查看Atlassian's AUI Sandbox

像這樣的東西應該做的伎倆在最近的版本JIRA的

按鈕HTML:

<button class="aui-button " href="#" id="popupLink"> 
    <span class="aui-icon aui-icon-small aui-iconfont-search-small">Search</span> Search on this issue 
</button> 

行爲的JavaScript:

AJS.InlineDialog(AJS.$("#popupLink"), 1, 
    function(content, trigger, showPopup) { 
     content.css({"padding":"20px"}).html(
      '<h2>Search something</h2>' 
      + '<form action="/path/to/your/servlet" method="get">' 
      + '<input name="q" placeholder="Search query..." >' 
      + '<input type="submit" value="Search">' 
      + '</form>' 
     ); 
     showPopup(); 
     return false; 
    } 
); 

這應該給你一個InlineDialog類似圖片如下:

enter image description here

此外,通過爲您的按鈕添加data-default-value屬性,您可以輕鬆預先填充InlineDialog中的搜索字段。

+1

謝謝,這正是我需要的! – Schadenfreude