| | |
| | | var r, len, rows = this.tbody.childNodes; |
| | | |
| | | for (r=0, len=rows.length; r<len; r++) { |
| | | this.init_row(rows[r]); |
| | | this.rowcount++; |
| | | this.rowcount += this.init_row(rows[r]) ? 1 : 0; |
| | | } |
| | | |
| | | this.init_header(); |
| | |
| | | |
| | | this.row_init(this.rows[uid]); // legacy support |
| | | this.triggerEvent('initrow', this.rows[uid]); |
| | | |
| | | return true; |
| | | } |
| | | }, |
| | | |
| | |
| | | // reset scroll position (in Opera) |
| | | if (this.frame) |
| | | this.frame.scrollTop = 0; |
| | | |
| | | // fix list header after removing any rows |
| | | this.resize(); |
| | | }, |
| | | |
| | | |
| | |
| | | */ |
| | | remove_row: function(uid, sel_next) |
| | | { |
| | | var node = this.rows[uid] ? this.rows[uid].obj : null; |
| | | var self = this, node = this.rows[uid] ? this.rows[uid].obj : null; |
| | | |
| | | if (!node) |
| | | return; |
| | |
| | | |
| | | delete this.rows[uid]; |
| | | this.rowcount--; |
| | | |
| | | // fix list header after removing any rows |
| | | clearTimeout(this.resize_timeout) |
| | | this.resize_timeout = setTimeout(function() { self.resize(); }, 50); |
| | | }, |
| | | |
| | | |
| | |
| | | */ |
| | | insert_row: function(row, before) |
| | | { |
| | | var tbody = this.tbody; |
| | | var self = this, tbody = this.tbody; |
| | | |
| | | // create a real dom node first |
| | | if (row.nodeName === undefined) { |
| | |
| | | |
| | | this.init_row(row); |
| | | this.rowcount++; |
| | | |
| | | // fix list header after adding any rows |
| | | clearTimeout(this.resize_timeout) |
| | | this.resize_timeout = setTimeout(function() { self.resize(); }, 50); |
| | | }, |
| | | |
| | | /** |
| | |
| | | if (rcube_event.get_button(e) == 2) |
| | | return true; |
| | | |
| | | this.in_selection_before = e && e.istouch || this.in_selection(id) ? id : false; |
| | | |
| | | // selects currently unselected row |
| | | if (!(e && e.istouch || this.in_selection(id))) { |
| | | if (!this.in_selection_before) { |
| | | var mod_key = rcube_event.get_modifier(e); |
| | | this.select_row(id, mod_key, false); |
| | | this.select_row(id, mod_key, true); |
| | | } |
| | | |
| | | if (this.draggable && this.selection.length && this.in_selection(id)) { |
| | | this.drag_start = true; |
| | | this.drag_mouse_start = rcube_event.get_mouse_pos(e); |
| | | |
| | | rcube_event.add_listener({event:'mousemove', object:this, method:'drag_mouse_move'}); |
| | | rcube_event.add_listener({event:'mouseup', object:this, method:'drag_mouse_up'}); |
| | | if (bw.touch) { |
| | |
| | | var now = new Date().getTime(), |
| | | dblclicked = now - this.rows[id].clicked < this.dblclick_time; |
| | | |
| | | // selects (or unselects currently selected) row |
| | | if (!this.drag_active && !dblclicked) |
| | | // unselects currently selected row |
| | | if (!this.drag_active && !dblclicked && this.in_selection_before == id) |
| | | this.select_row(id, rcube_event.get_modifier(e), true); |
| | | |
| | | this.drag_start = false; |
| | | this.in_selection_before = false; |
| | | |
| | | // row was double clicked |
| | | if (this.rowcount && dblclicked && this.in_selection(id)) { |
| | |
| | | select_row: function(id, mod_key, with_mouse) |
| | | { |
| | | var select_before = this.selection.join(','); |
| | | |
| | | if (!this.multiselect) |
| | | mod_key = 0; |
| | | |
| | |
| | | this.highlight_row(id, false); |
| | | break; |
| | | } |
| | | |
| | | this.multi_selecting = true; |
| | | } |
| | | |
| | |
| | | |
| | | for (i=0; i<len; i++) |
| | | if (!this.in_selection(children[i])) |
| | | this.select_row(children[i], CONTROL_KEY); |
| | | this.select_row(children[i], CONTROL_KEY, true); |
| | | }, |
| | | |
| | | |
| | |
| | | // Stop propagation so that the browser doesn't scroll |
| | | rcube_event.cancel(e); |
| | | return this.use_arrow_key(keyCode, mod_key); |
| | | |
| | | case 32: |
| | | rcube_event.cancel(e); |
| | | return this.select_row(this.last_selected, mod_key, true); |
| | | |
| | | case 37: // Left arrow key |
| | | case 39: // Right arrow key |
| | | case 107: // Plus sign on a numeric keypad |
| | | case 109: // Minus sign on a numeric keypad |
| | | case 109: // Minus sign on a numeric keypad |
| | | // Stop propagation |
| | | rcube_event.cancel(e); |
| | | var ret = this.use_plusminus_key(keyCode, mod_key); |
| | |
| | | this.triggerEvent('keypress'); |
| | | this.modkey = 0; |
| | | return ret; |
| | | |
| | | case 36: // Home |
| | | this.select_first(mod_key); |
| | | return rcube_event.cancel(e); |
| | | |
| | | case 35: // End |
| | | this.select_last(mod_key); |
| | | return rcube_event.cancel(e); |
| | | |
| | | case 27: |
| | | if (this.drag_active) |
| | | return this.drag_mouse_up(e); |
| | | |
| | | if (this.col_drag_active) { |
| | | this.selected_column = null; |
| | | return this.column_drag_mouse_up(e); |
| | | } |
| | | |
| | | return rcube_event.cancel(e); |
| | | |
| | | default: |
| | | this.key_pressed = keyCode; |
| | | this.modkey = mod_key; |
| | |
| | | */ |
| | | del_dragfix: function() |
| | | { |
| | | $('div.iframe-dragdrop-fix').each(function() { this.parentNode.removeChild(this); }); |
| | | $('div.iframe-dragdrop-fix').remove(); |
| | | }, |
| | | |
| | | |