Ajout de l'argument « skipfile » qui permet de marquer de manière externe les élément...
[Portfolio.git] / skins / cart_listing.js
1 /*
2 * © 2009 Luxia SAS. All rights reserved.
3 * Contributors
4 * — Benoît Pin <pinbe@luxia.fr>
5 *
6 *
7 *
8 */
9
10 var CartListing;
11
12 (function(){
13 var ENTERKEY = 13;
14
15 CartListing = function(table) {
16 var thisCL = this;
17 this.table = table;
18 var form = table.parentNode;
19 while(form.tagName != 'FORM')
20 form = form.parentNode;
21
22 this.fm = new FormManager(form);
23
24 if (browser.isIE)
25 addListener(table, 'focusout', function(evt){thisCL.updateRow(evt);});
26 else
27 addListener(table, 'change', function(evt){thisCL.updateRow(evt);});
28
29 addListener(table, 'keypress', function(evt){thisCL.onKeypress(evt);});
30 }
31
32 CartListing.prototype.updateRow = function(evt) {
33 var target = getTargetedObject(evt);
34 if (target.tagName != 'INPUT')
35 return;
36
37
38 var row = target.parentNode.parentNode;
39 var inputs = row.getElementsByTagName('input')
40 var refreshBtn = inputs[1];
41 this.fm.submitButton = refreshBtn;
42 this.fm.submit(evt);
43 };
44
45 CartListing.prototype.onKeypress = function(evt){
46 if (evt.keyCode == ENTERKEY)
47 this.updateRow(evt);
48 };
49
50 })();