我想点击事件绑定到的XPages提前键入li元素 [英] I want to bind the click event to the li elements in the xpages type-ahead
问题描述
我是用添Tripconys看中提前输入解决方案,它是工作的罚款。
http://www.timtripcony.com/blog.nsf/d6plinks/TTRY-7XD5P9
I am using Tim Tripconys fancy type-ahead solution and it is working fine. http://www.timtripcony.com/blog.nsf/d6plinks/TTRY-7XD5P9
但我想它以不同behaive,而不是从选择的下拉项我想点击事件的用户连接到所选条目并重定向到所选文档的值填充编辑框一点。
But I want it to behaive a bit differently, instead of filling the editbox with the value from the selected dropdown entry I want to attach a click event to the selected entry and redirect the user to the selected document.
这意味着我需要重写当前点击事件,并发送一个隐藏的UNID我的click事件,并做重定向在JavaScript。
this means that I need to override the current click event and send a hidden "unid" to my click event and do the redirect in javascript.
我试图一类添加到我的SSJS功能UL和李元素,所以我可以将它们绑定到click事件。但是这似乎并没有被应用。而我不知道,因为是在预输入Ajax的控制没有事件处理程序,我应该如何附上click事件。
I have tried to add a class to the ul and li elements in my SSJS function so I can bind them to the click event. but that does not seem to be applied. and I am not sure how I should attach the click event as there is no eventhandler on the typeahead "ajax" control.
这就是我要做的。
- 用户在编辑框中 输入字符
- 键盘缓冲返回结果为下拉列表中的XPages
- 每个文档的UNID返回需要在隐藏在下拉
- 单击下拉条目之一将重定向到显示用户点击的基础上隐藏UNID文档的另一页。
BTW。我知道如何事件,所以我需要这个没有进一步的解释绑定,但我需要知道如何做到这一点相对于XPages中提前键入功能。
btw. I know how to bind an event so I need no further explaination of this, but I need to know how to do it in relation to the type-ahead feature in xpages.
下面是从从下拉列表生成的HTML元素的样品
Below is a sample from the html elements that are generated from dropdown
<ul class="dijitReset dijitMenu dijitComboBoxMenu" dojoattachevent="onmousedown:_onMouseDown,onmouseup:_onMouseUp,onmouseover:_onMouseOver,onm>ouseout:_onMouseOut" style="top: 0px; overflow-x: hidden; overflow-y: hidden; width: 310px; visibility: visible; " id="home:_id1:_id19:_id29:search_popup" dir="" widgetid="home:_id1:_id19:_id29:search_popup">
<li class="dijitReset dijitMenuItem" role="option" id="home:_id1:_id19:_id29:search_popup1">
<table>
<tbody>
<tr>
<td><img src=""></td><td valign="top"><p><strong>Entry1</strong></p>
<p>
<span class="informal">TADN-8CWLTP<br>2012-03-01 09:29:07 CET<br>Test</span>
</p>
</td>
</tr>
</tbody>
</table>
</li>
<li class="dijitMenuItem dijitMenuNextButton" dojoattachpoint="nextButton" role="option" style="display: none; " id="home:_id1:_id19:_id29:search_popup_next">More choices</li>
</ul>
谢谢
托马斯
Thanks Thomas
推荐答案
看起来像我解决了它自己,见下文
Look like I solved it myself, see below
首先,我添加了一个类UNID表在下拉
First, I added a class and unid to the table in the dropdown
<li><table id=\"" + unid + "\" class=\"clicktable\">....</li></code>
第二,在onclick事件我使用jQuery表绑定到点击功能的现场()
Second, in the onclick event I bind the table to the click function using jquery live()
$(".clicktable").live("click", function(){
alert($(this).attr("id"))
});
所以当用户单击下拉条目表点击而不是里,我可以再容易写code,将用户重定向,因为我知道知道哪些UNID被点击了。
so when user click the dropdown entry the table is clicked instead of the li, and I can then easy write code to redirect the user as I know know which unid was clicked.
这篇关于我想点击事件绑定到的XPages提前键入li元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!