Revision 70320f38
Factorisation de l'utilisation des bibliothèques JS
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@6851 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/public/js/autocompleter-vigilo.js | ||
---|---|---|
1 |
/** |
|
2 |
* Autocompleter.Request.VigiloJSON |
|
3 |
* |
|
4 |
*/ |
|
5 |
Autocompleter.Request.VigiloJSON = new Class({ |
|
6 |
|
|
7 |
Extends: Autocompleter.Request, |
|
8 |
|
|
9 |
options: { |
|
10 |
resVar: 'results' |
|
11 |
}, |
|
12 |
|
|
13 |
initialize: function(el, url, options) { |
|
14 |
this.parent(el, options); |
|
15 |
this.request = new Request.JSON($merge({ |
|
16 |
'url': url, |
|
17 |
'link': 'cancel' |
|
18 |
}, this.options.ajaxOptions)).addEvent('onComplete', this.queryResponse.bind(this)); |
|
19 |
}, |
|
20 |
|
|
21 |
queryResponse: function(response) { |
|
22 |
this.parent(); |
|
23 |
this.update(response[this.options.resVar]); |
|
24 |
} |
|
25 |
|
|
26 |
}); |
Also available in: Unified diff