mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
Merge pull request #57 from asig2016/add_class_to_dropdown
select-cat widget: add different class per level to allow different …
This commit is contained in:
commit
7160990b4f
@ -246,8 +246,9 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
* @param {string} _label label of option
|
||||
* @param {string} _title title attribute of option
|
||||
* @param {node} dom_element parent of new option
|
||||
* @param {string} _class specify classes of option
|
||||
*/
|
||||
_appendOptionElement: function(_value, _label, _title, dom_element) {
|
||||
_appendOptionElement: function(_value, _label, _title, dom_element, _class) {
|
||||
if(_value == "" && (_label == null || _label == "")) {
|
||||
return; // empty_label is added in set_select_options anyway, ignoring it here to not add it twice
|
||||
}
|
||||
@ -260,6 +261,9 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
var option = jQuery(document.createElement("option"))
|
||||
.attr("value", _value)
|
||||
.text(_label+"");
|
||||
|
||||
option.addClass(_class);
|
||||
|
||||
if (this.options.tags && this._type == 'select-cat')
|
||||
{
|
||||
option.addClass('cat_'+_value);
|
||||
@ -856,7 +860,9 @@ var et2_selectbox = (function(){ "use strict"; return et2_inputWidget.extend(
|
||||
{
|
||||
this._appendOptionElement(typeof _options[key].value != 'undefined' ? _options[key].value : key,
|
||||
_options[key]["label"] ? _options[key]["label"] : "",
|
||||
_options[key]["title"] ? _options[key]["title"] : "");
|
||||
_options[key]["title"] ? _options[key]["title"] : "",
|
||||
'',
|
||||
_options[key]["class"] ? _options[key]["class"] : "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -605,7 +605,9 @@ class Select extends Etemplate\Widget
|
||||
// These are extra info for easy dealing with categories
|
||||
// client side, without extra loading
|
||||
'main' => (int)$cat['main'],
|
||||
'children' => $cat['children']
|
||||
'children' => $cat['children'],
|
||||
//add different class per level to allow different styling for each category level:
|
||||
'class' => "cat_level". $cat['level']
|
||||
);
|
||||
// Send data too
|
||||
if(is_array($cat['data']))
|
||||
|
Loading…
Reference in New Issue
Block a user