Author: nathangray
New Revision: 55317
URL: http://svn.stylite.de/viewvc/egroupware?rev=55317&view=rev
Log:
Respect rows attribute to restrict how big the taglist is allowed to get
Modified:
trunk/etemplate/js/et2_widget_taglist.js
trunk/etemplate/templates/default/etemplate2.css
— trunk/etemplate/js/et2_widget_taglist.js (original)
+++ trunk/etemplate/js/et2_widget_taglist.js Tue Mar 8 23:23:07 2016
@@ -103,7 +103,12 @@
default: true,
description: “True, false or ‘toggle’”
},
-
"rows": {
-
"name": "Rows",
-
"type": "integer",
-
"default": et2_no_init,
-
"description": "Number of rows to display"
-
},
"tags": { ignore: true},
useCommaKey: {
name: "comma will start validation",
@@ -120,8 +125,11 @@
*
* @memberOf et2_selectbox
*/
- init: function(_parent, _attrs) {
this._super.apply(this, arguments);
-
-
// Parent sets multiple based on rows, we just re-set it
-
this.options.multiple = _attrs.multiple;
// jQuery wrapped DOM node
this.div = jQuery("<div></div>").addClass('et2_taglist');
@@ -132,6 +140,7 @@
this._set_multiple(!this._multiple);
},this))
.appendTo(this.div);
@@ -247,18 +256,26 @@
});
}
-
this.$taglist
.on("beforeload", function() {this.container.prepend('<div class="ui-icon loading"/>');})
.on("load", function() {$j('.loading',this.container).remove();})
// Keep focus when selecting from the list
-
.on("selectionchange", function() { $j('input',this.container).focus();})
-
.on("selectionchange", function() {
-
$j('input',this.container).focus();
-
widget.resize();
-
})
// Bind keyup so we can start ajax search when we like
.on('keyup.start_search', jQuery.proxy(this._keyup, this))
-
.on('blur', jQuery.proxy(function() {
-
this.div.removeClass('ui-state-active');
-
this.resize();
-
}, this))
// Hide tooltip when you're editing, it can get annoying otherwise
.on('focus', function() {
$j('.egw_tooltip').hide();
-
widget.div.addClass('ui-state-active');
})
// Position absolute to break out of containers
.on('expand', jQuery.proxy(function(c) {
@@ -268,13 +285,24 @@
// Keep any additional classes
.addClass(this.div.attr(‘class’))
-
.css({
-
'position': 'absolute',
-
'width': 'auto'
-
})
.appendTo('body')
-
.position({my: 'left top', at: 'left bottom', of: this.taglist.container});
-
this.taglist.combobox
.width(this.taglist.container.innerWidth())
.appendTo(wrapper)
.css('background', background);
-
-
// Make sure it doesn't go out of the window
-
var bottom = (wrapper.offset().top + this.taglist.combobox.outerHeight(true));
-
if(bottom > $j(window).height())
-
{
-
this.taglist.combobox.height(this.taglist.combobox.height() - (bottom - $j(window).height()) - 5);
-
}
// Close dropdown if click elsewhere, but wait until after or it
// will close immediately
@@ -320,7 +348,7 @@
// Do size limit checks
this.resize();
@@ -485,6 +513,39 @@
},
/**
-
- Normally the widget will display 1 row (multiple off) or expand as needed
-
- based on selected entries. Setting row will limit the max height.
-
- */
- set_rows: function(_rows)
- {
-
_rows = parseInt(_rows);
-
var css = {
-
'max-height': '',
-
'height': 'auto'
-
}
-
if(_rows)
-
{
-
var max = (25 * _rows) + _rows;
-
css['max-height'] = max+'px';
-
if(this._multiple)
-
{
-
css.height = max+'px';
-
}
-
this.div.addClass('et2_taglist_small');
-
}
-
this.div.css(css);
-
if(this.options.rows != _rows)
-
{
-
if(this.taglist !== null)
-
{
-
this.resize();
-
}
-
this.options.rows = _rows;
-
}
- },
-
- /**
- Set whether the widget accepts only 1 value, many, or allows the user
- to toggle between the two.
-
@@ -494,6 +555,7 @@
if(multiple != this.options.multiple)
{
this.options.multiple = multiple;
@@ -513,6 +575,7 @@
}
// This changes sizes, so
@@ -532,7 +595,7 @@
this.div.attr(‘data-content’,’’);
}
@@ -554,6 +617,7 @@
this._hide_timeout = window.setTimeout(
jQuery.proxy(function() {
this.div.removeClass(‘ui-state-hover’);
@@ -562,8 +626,8 @@
);
this.$taglist
.on(‘blur.small_size’, jQuery.proxy(function() {
@@ -573,6 +637,7 @@
window.clearTimeout(this._hide_timeout);
}
},this))
-
this.taglist.container[0].scrollIntoView();
},
/**
@@ -654,7 +719,7 @@
resize: function() {
this.div.off('.small_size');
— trunk/etemplate/templates/default/etemplate2.css (original)
+++ trunk/etemplate/templates/default/etemplate2.css Tue Mar 8 23:23:07 2016
@@ -1000,7 +1000,7 @@
font-weight: bold;
}
/* min-height to fix calculations done while hidden /
-.et2_taglist > div:first-child {
+.et2_taglist, .et2_taglist > div:first-child {
min-height: 23px;
}
/ Toggle single / multiple */
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs