Autocompleter.Request.HTML

18 views
Skip to first unread message

faust45

unread,
Feb 9, 2010, 11:37:38 AM2/9/10
to MooTools для разработчиков
Всем привет.

Autocompleter.Request.HTML
хочется ловить событие пользователь выбрал элемент
пробывал ловить onSelection но в парамтрах приходит <ul>
а мне нужен выбраный <li>

вот что туда передаётся в параметры
this.fireEvent('onSelection', [this.element, this.selected, value,
input]);

не пойму как мне получать выбраный пользователем li

Заранне спасибо!

ApelSYN

unread,
Feb 9, 2010, 3:49:08 PM2/9/10
to MooTools для разработчиков
html к которому цепляешь событие напиши

faust45

unread,
Feb 10, 2010, 2:14:07 AM2/10/10
to MooTools для разработчиков
не понял вопрос.

сервер отдаёт список
<ul>
<li></li>
</ul>

'injectChoice': function(choice) {
// choice is one <li> element
var text = choice.getFirst();
// the first element in this <li> is the <span> with the text
var value = text.innerHTML;
// inputValue saves value of the element for later selection
choice.inputValue = value;
// overrides the html with the marked query value (wrapped in a
<span>)
text.set('html', this.markQueryValue(value));
// add the mouse events to the <li> element
this.addChoiceEvents(choice);
},

faust45

unread,
Feb 10, 2010, 2:15:59 AM2/10/10
to MooTools для разработчиков
ой жесть а что ето с кодировками

On 10 фев, 10:14, faust45 <faust...@gmail.com> wrote:
> ÎÅ ÐÏÎÑÌ ×ÏÐÒÏÓ.
>
> ÓÅÒ×ÅÒ ÏÔÄÁ£Ô ÓÐÉÓÏË


>   <ul>
>      <li></li>
>   </ul>
>
>   'injectChoice': function(choice) {
>             // choice is one <li> element
>             var text = choice.getFirst();
>             // the first element in this <li> is the <span> with the text
>             var value = text.innerHTML;
>             // inputValue saves value of the element for later selection
>             choice.inputValue = value;
>             // overrides the html with the marked query value (wrapped in a
> <span>)
>             text.set('html', this.markQueryValue(value));
>             // add the mouse events to the <li> element
>             this.addChoiceEvents(choice);
>         },
>

> On 9 ÆÅ×, 23:49, ApelSYN <oleg.cher...@gmail.com> wrote:
>
>
>
> > html Ë ËÏÔÏÒÏÍÕ ÃÅÐÌÑÅÛØ ÓÏÂÙÔÉÅ ÎÁÐÉÛÉ
>
> > On 9 ÆÅ×, 18:37, faust45 <faust...@gmail.com> wrote:
>
> > > ÷ÓÅÍ ÐÒÉ×ÅÔ.
>
> > > Autocompleter.Request.HTML
> > > ÈÏÞÅÔÓÑ ÌÏ×ÉÔØ ÓÏÂÙÔÉÅ ÐÏÌØÚÏ×ÁÔÅÌØ ×ÙÂÒÁÌ ÜÌÅÍÅÎÔ
> > > ÐÒÏÂÙ×ÁÌ ÌÏ×ÉÔØ onSelection ÎÏ × ÐÁÒÁÍÔÒÁÈ ÐÒÉÈÏÄÉÔ <ul>
> > > Á ÍÎÅ ÎÕÖÅÎ ×ÙÂÒÁÎÙÊ <li>
>
> > > ×ÏÔ ÞÔÏ ÔÕÄÁ ÐÅÒÅÄÁ£ÔÓÑ × ÐÁÒÁÍÅÔÒÙ


> > > this.fireEvent('onSelection', [this.element, this.selected, value,
> > > input]);
>

> > > ÎÅ ÐÏÊÍÕ ËÁË ÍÎÅ ÐÏÌÕÞÁÔØ ×ÙÂÒÁÎÙÊ ÐÏÌØÚÏ×ÁÔÅÌÅÍ li
>
> > > úÁÒÁÎÎÅ ÓÐÁÓÉÂÏ!

faust45

unread,
Feb 10, 2010, 2:16:58 AM2/10/10
to MooTools для разработчиков
ссори там где абракадабра
было написано

я несовсем понял вопрос

ApelSYN

unread,
Feb 14, 2010, 6:39:54 AM2/14/10
to MooTools для разработчиков
<ul id="myList">
<li>Item 1</li>
<li>Item 2</li>
</ul>

<script>
$each($$('#myList li'), function(li,index) {
li.addEvent('click', function(event) {
// тут пишем обработчик, который срабатывает при нажатии на один из
li, например:
alert(li.get('html'))
}.bind(this));
})
</script>

Reply all
Reply to author
Forward
0 new messages