Skip to content

Commit

Permalink
#2836 developing of headerMenu extension - settings updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice Trofimova committed Nov 30, 2015
1 parent 2fc96f8 commit 349898b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
1 change: 0 additions & 1 deletion core/src/main/web/app/styles/dropdowns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@

.dropdown-menu {
position: absolute;
display: block;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -859,24 +859,46 @@
},
{
title: 'Visible',
action: null
isChecked: function() {},
action: function(e) {
e.preventDefault;

}
},
{
title: 'Alignment',
action: null,
items: []
//move to plugin
items: [
{
title: 'Left',
isChecked: function() {},
action: function() {}
},
{
title: 'Center',
isChecked: function() {},
action: function() {}
},
{
title: 'Right',
isChecked: function() {},
action: function() {}
}
]
},
{
title: 'Sorting',
action: null,
//move to plugin
items: [
{
name: 'Ascending',
title: 'Ascending',
isChecked: function() {},
action: function() {}
},
{
name: 'Descending',
title: 'Descending',
isChecked: function() {},
action: function() {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ HeaderMenu.prototype = {
var menuItems = el.data('menu');

if ($.isArray(menuItems)) {
var $menu = $("<ul/>", { 'class': 'dropdown-menu' });
var $menu = $("<ul/>", { 'class': 'dropdown-menu' })
.attr('eat-click', '');
var node = this.dom.container;

that._buildMenuItems(menuItems, $menu);
Expand All @@ -138,6 +139,7 @@ HeaderMenu.prototype = {
top: el.height() + 10,
left: el.offset().left - 51
})
.css('display', 'block')
.appendTo(node);
that.dom.menu = $menu;
}
Expand All @@ -153,12 +155,11 @@ HeaderMenu.prototype = {
return;
}

var hasSubitems = $.isArray(oItems.items) && oItems.items.length;

for (var i = 0, ien = oItems.length; i < ien; i++) {
var oItem = oItems[i];
var hasSubitems = $.isArray(oItem.items) && oItem.items.length;

var $item = $('<li/>', {'class': hasSubitems ? 'dropdown-submenu drop-left' : ''})
var $item = $('<li/>', {'class': hasSubitems ? 'dropdown-submenu' : ''})
.append(
$('<a/>')
.attr('href', '#')
Expand All @@ -167,15 +168,23 @@ HeaderMenu.prototype = {
.attr('eat-click', '')
.text(oItem.title)
);
//also append
//<i class="glyphicon glyphicon-ok"></i>

if (hasSubitems) {
var $subContainer = $('<ul/>', { 'class': 'dropdown-menu bko-header-menu' });
var $subContainer = $('<ul/>', { 'class': 'dropdown-menu' });
$subContainer.appendTo($item);
this._buildMenuItems(oItem.items, $subContainer);
}

$item.appendTo(container);
}
},

_toggleVisibility: function(el) {

//var column = this.dt.column( $(el).attr('data-column') );
//column.visible( ! column.visible() );
}
};

Expand All @@ -185,12 +194,15 @@ HeaderMenu.defaults = {
tag: 'ul',
class: 'dropdown-menu',
attrs: {
'role': 'menu',
'submenu-classes': 'drop-right',
'aria-labelledby': 'dLabel'
'role': 'menu'
}
}
}
},
toAdd: [
{
parent: 'Format'
}
]
};

$.fn.dataTable.HeaderMenu = HeaderMenu;
Expand Down

0 comments on commit 349898b

Please sign in to comment.