Changeset 298
- Timestamp:
- Mar 22, 2010, 2:30:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web-app/js/table-editor.js
r262 r298 52 52 $(table).selectable({ 53 53 filter: this.rowIdentifier, 54 stop: function() { 55 // remember selected rows 56 that.selected = $('.ui-selected', table); 57 58 // bind on change to columns in rows 59 that.selected.each(function() { 60 that.attachColumnHandlers(this,table); 61 }) 54 selected: function(event, ui) { 55 that.attachColumnHandlers(ui.selected); 56 }, 57 unselected: function(event, ui) { 58 that.deAttachColumnHandlers(ui.selected); 62 59 } 63 60 }); … … 65 62 66 63 /** 64 * de-attach input handlers for this row 65 * @param row 66 */ 67 deAttachColumnHandlers: function(row) { 68 var that = this; 69 70 $(this.columnIdentifier, row).each(function() { 71 var input = $(':input', $(this)); 72 73 // does this column contain an input field 74 if (input) { 75 // unbind table editor event handlers 76 $(input).unbind('.tableEditor'); 77 } 78 }); 79 }, 80 81 /** 67 82 * attach handlers to the input elements in a table row 68 83 * @param row 69 84 */ 70 attachColumnHandlers: function(row ,table) {85 attachColumnHandlers: function(row) { 71 86 var that = this; 72 87 var count = 0; … … 75 90 var regAutoComplete = new RegExp("ui-autocomplete-input"); 76 91 77 $(this.columnIdentifier, $(row)).each(function() {92 $(this.columnIdentifier, row).each(function() { 78 93 var input = $(':input', $(this)); 94 79 95 // does this column contain an input field 80 96 if (input) { … … 91 107 if (regAutoComplete.test(inputElement.attr('class'))) { 92 108 // this is a jquery-ui autocomplete field 93 inputElement.bind('autocompleteclose ', function() {109 inputElement.bind('autocompleteclose.tableEditor', function() { 94 110 // TODO: autocompletion deselects rows... which is what we don't want 95 111 // to happen of course... 96 112 that.updateSingleInputElements(input, columnNumber, 'input'); 97 }) 113 }); 98 114 } else { 99 115 // regular text element 100 inputElement.bind('keyup ', function() {116 inputElement.bind('keyup.tableEditor', function() { 101 117 that.updateSingleInputElements(input, columnNumber, 'input'); 102 118 }); … … 106 122 // single select 107 123 var columnNumber = count; 108 inputElement.bind('change ', function() {124 inputElement.bind('change.tableEditor', function() { 109 125 that.updateSingleInputElements(input, columnNumber, 'select'); 110 126 }); … … 113 129 // checkbox 114 130 var columnNumber = count; 115 inputElement.bind('click ', function() {131 inputElement.bind('click.tableEditor', function() { 116 132 that.updateSingleInputElements(input, columnNumber, 'input'); 117 133 });
Note: See TracChangeset
for help on using the changeset viewer.