Changeset 733 for trunk/web-app


Ignore:
Timestamp:
Jul 27, 2010, 4:08:14 PM (10 years ago)
Author:
duh
Message:
  • resolved issue #153: sample page eventhandlers are bound in the wrong order
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web-app/js/table-editor.js

    r460 r733  
    9797            // does this column contain an input field
    9898            if (input && type) {
     99                // check field type
    99100                switch (type) {
    100101                    case 'text':
     
    123124                        inputElement.bind('change.tableEditor', function() {
    124125                            that.updateSingleInputElements(input, columnNumber, 'select');
     126
     127                            // probably we want to bind these extra event handlers
     128                            // separately, but for now this will suffice :)
     129                            that.handleExtraEvents( inputElement );
    125130                        });
    126131                        break;
     
    211216                break;
    212217        }
     218    },
     219
     220    /**
     221     * execute extra functions when binding to a particular event. The extra change
     222     * handlers are called after replicating template fields
     223     * example: <select ... tableEditorChangeEvent="console.log(element);" ... />
     224     * @param element
     225     */
     226    handleExtraEvents: function( element ) {
     227        // define parameters
     228        var events = ['change'];
     229
     230        // check if we need to execute some more event handlers
     231        for ( var i=0; i < events.length; i++ ) {
     232            var call = element.attr('tableEditor' + events[ i ].substr(0, 1).toUpperCase() + events[ i ].substr(1).toLowerCase() + 'Event');
     233            if ( call ) {
     234                // yes, execute!
     235                eval( call );
     236            }
     237        }
    213238    }
    214239}
Note: See TracChangeset for help on using the changeset viewer.