~unifield-team/unifield-web/web-utp-816

« back to all changes in this revision

Viewing changes to addons/openerp/static/javascript/m2o.js

  • Committer: jf
  • Date: 2013-05-24 16:03:21 UTC
  • mfrom: (4708.1.2 unifield-web)
  • Revision ID: jfb@tempo-consulting.fr-20130524160321-an28w20b8lsl3vq1
UF-748 [FIX] js performance
OEB-101 [FIX] exponential call to form_onAttrChange
lp:~unifield-team/unifield-web/web-UF-748

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    this.relation = jQuery(this.field).attr('relation');
65
65
    jQuery(this.text).attr('autocomplete', 'OFF');
66
66
 
67
 
    if(this.editable) {
68
 
        jQuery(this.field).change(jQuery.proxy(this, 'on_change'));
 
67
    // test on this.text: if it doesn't exist the field is hidden (ie: composition_list_id when processing an Incoming Shipment
 
68
    if(this.editable && this.text) {
69
69
        jQuery(this.text).bind({
70
70
            keydown: jQuery.proxy(this, 'on_keydown'),
71
71
            keypress: jQuery.proxy(this, 'on_keypress'),
73
73
            focus: jQuery.proxy(this, 'gotFocus'),
74
74
            blur: jQuery.proxy(this, 'lostFocus')
75
75
        }).removeAttr('callback');
76
 
 
77
76
        this.lastTextResult = this.text.value;
78
77
 
79
78
        if(this.select_img)
295
294
 
296
295
                this.setCompletionText($selectedRow);
297
296
 
298
 
                if(this.callback) {
299
 
                    onChange(this.name);
300
 
                }
 
297
                $(this.field).change();
301
298
                this.change_icon();
302
299
                this.clearResults();
303
300
                break;
336
333
    if((evt.which == 8 || evt.which == 46) && this.field.value) {
337
334
        this.text.value = '';
338
335
        this.field.value = '';
339
 
        this.on_change(evt);
 
336
        $(this.field).change();
340
337
    }
341
338
 
342
339
    //Tab