List
misc
Items in list
misc
Items in list
| Example |
|
| HTML code | <ul class="Row">
<li class="header">
<DIV class=link>
<div class="text">
<h4 class=title>List header</h4>
</div>
<div class="menu"><a href="table/add" tooltip="Lisää uusi"><i class="fa fa-app-addnew"></i></a></div>
</DIV>
</li>
<li class="link">
<DIV class=link>
<div class="color green"></div>
<a onclick="alert('Item clicked')">
<div class="icon"><i class="fa fa-action-print"></i></div>
<div class="text"><h4 class=title>List item</h4></div>
<div class="info"><span class="amount">2</span></div>
</a>
<div class="menu"><i class="fa fa-app-info" onclick="alert('Menu clicked')" tooltip="Menu tooltip"></i></div>
</DIV>
</li>
</ul> |
| Type | molecule |
| Group | misc |
| Todo | row check as callback link--placeholder link to BEM!! |
Wrapper to use element through PHP
| Extends | eUiElement | ||||
| Render | javascript | ||||
| Create arguments | |||||
| Methods |
|
||||
| Code example | $List = $this->get('ui', 'list');
$List->addItem(Array(
'name' => 'name',
'value' => $value,
'placeholder' => 'Example value',
'tooltip' => 'Tooltip text',
'width' => 100
));
NOTE: PHP wrapper renders Javascript object that creates the list. |
Wrapper to use element through Javascript
| Methods |
|
||||||||||||||||||||||
| Code example | Simple usevar $List = cms.get('ui', 'list').appendto(elem);
$List.addItem({
title: 'Title text',
link: 'table/order/', // If link
onclick: 'myFunction()', // If function to run
onclick: function(){}, // If callback
});
// Header can have all parameters as normal list item.
$List.addHeader({
title: 'Header text'
});Additional elementsDescription, Content, Tooltip, Color, Icon, Label, Info, Amount, Number $List.addItem({
title: 'Title text',
description: 'Additionl description text',
content: 'Text to be shown when menu -icon is clicked',
tooltip: 'Hovertext',
color: 'green',
icon: 'app-addnew',
label: 'Label text',
info: 'Infotext',
amount: 123,
number: 2
});Additional action elementsButton, Menu $List.addItem({
title: 'Title text'
button: [{
icon: 'app-addnew',
onclick: function(){}
}]
menu: [{
icon: 'app-remove',
onclick: function(){}
}]
});Nested listNested list can be given as list, List object ot callback function. var $List = cms.get('ui', 'list').appendto(elem);
/*** Subitems in list ***/
$List.addItem({
title: 'Main item',
items: [{
title: 'Subitem 1'
},{
title: 'Subitem 2'
}]
});
/*** Subitems as Ui List ***/
var $Sublist = cms.get('ui', 'list');
$Sublist.addItem({
title: 'Subitem 1',
});
$List.addItem({
title: 'Main item',
items: $Sublist
});
// Subitems parameters: Open on init
$List.addItem({
title: 'Main item',
items: {
open: true,
data: $Sublist
}
});
/*** Subitems as callback ***/
$List.addItem({
title: 'Main item',
items: function($Sublist,callback){
$Sublist.addItem({
title: 'Subitem 1',
});
callback(); // Tell the main list that this is ready
}
});ContentAdditional content under the list item. var $List = cms.get('ui', 'list', {
title: 'Title text', // Set as header -item title.
});
$List.addItem({
title: 'Content as text',
content: 'Show me all the time.'
});
$List.addItem({
title: 'Content as function',
content: function(elem){
$(elem).append('Show me when toggled.');
}
});
$List.addItem({
title: 'Content as object',
content: {
toggle: true,
text: 'Show me when menu -icon is clicked'
onopen: function(elem){
$(elem).append('Show me when toggled.');
}
}
});Additional parametersAll available parameters var $List = cms.get('ui', 'list', {
title: 'Title text', // Set as header -item title.
selected: selectedId, // Marks item with same id selected.
colorStyle: 'column', // How to show link coloe: column, circle, background
height: 400, // Fixed height (overflow: scroll).
maxHeight: 400, // Max available height (overflow: scroll).
maxWidth: 200, // Max available width (overflow: scroll).
style: 'row', // title, grid - May not implementhave all item parameters.
ordered: true, // Automatic order number
ordered: 100, // Automatic order number, start value
items: [{}], // Items data.
});
$List.addItem({
### Technical
id: 1000, // set as attribute: data-id
value: 'myval' // set as attribute: data-value
### Visual
indent: 2, // Add margin
order: 3, // Custom order number on left
iconUrl: 'url.to/img.png', // Img icon
icon: 'app-addnew', // Fonticon name or Imageicon.png filename
title: 'Main text',
description: 'Additional text',
description: [
'First line',
'Second line'
],
progress: 75, // Percent
progress: {
value: 75, // Percent, if no total
total: 200,
color: 'green'
},
content: 'Text to be shown'
content: function(elem){
$(elem).html('SET ME WHEN CONTENT TOGGLE')
},
content: {
text: 'Initial context',
open: false, // initial state,
tooltip: 'Show me on hover',
toggle: false, // Show toggle button. If false, open is always true.
onopen: function(elem){
$(elem).html('SET ME AS CONTENT')
}
},
info: 'Additional', // Gray text on right
tooltip: 'Hovertext', // Tooltip text
label: 'Important', // Label on right
amount: 120, // Amount on right
### Action
selected: false, // Set item as selected.
// Add checkbox.
check: {
onclick: 'alert("Check change")'
// checked: false,
// ... any value that in uiButton
}
link: 'table/asiakas/page/1000'
link: {
href: ''
//
},
onclick: 'runFunction()',
onclick: function(){
// Callback function
}
// Buttons: In beginning of the row. Same parameters as button.
button: [{
icon: 'app-edit',
color: 'red',
onclick: function(){
alert('Button clicked');
}
}],
// Menu: In end of the row. Same parameters as button.
menu: [{
icon: 'app-addnew'
onclick: function(){
alert('Menu clicked');
}
}]
}); |
Elements Css style
| small | < class='row small'>Small{tag}> |
| plain | < class='row plain'>Plain{tag}> |
| inline | < class='row inline'>Inline{tag}> In single row |
| multirow | < class='row multirow'>Multirow{tag}> Allow title and description to go multiple lines. |