# j-Planner

> Display scheduled items in a planner.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 192e6c314650ebdc78e694b02744bfab9b7de151595dadd9e317353da6422675
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

__Data-source__ needs to contain:

```js
{
    items: [{ id: '12345', name: 'A name of plan', dtbeg: NOW.add('-5 days'), dtend: NOW.add('3 days'), progress: 30, color: '#5385EA', title: 'A tooltip' }, ...] // items
    year: 2019
}
```

__Configuration__:

- `days {String}` pluralization for days (optional, default: `# days,# day,# days,# days`)
- `exec {String}` a path to variable or method `function(item, el)`, it's evaluated if the user will click on the item
- `scroll {String}` a path to variable or method `function(y)`, it's evaluated if the user will scroll planner
- `parent {String}` optional, a container with fixed width/height, can be `window`. Default value: `parent` element.)

Use it with `<ui-component name="planner">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<style>
	body{padding:0;margin:0;background-color:#F0F0F0;font-family:Arial;height:100%;}
	html{height:100%;}
</style>

<ui-component name="planner" path="obj" config="exec:selected">
</ui-component>

<script>

	var obj = {};
	obj.year = NOW.getFullYear();
	obj.items = [];
	obj.items.push({ id: '1', name: 'jComponent', dtbeg: NOW.add('-5 days'), dtend: NOW.add('3 days'), progress: 30, color: '#769DEA' });
	obj.items.push({ id: '2', name: 'Total.js', dtbeg: NOW.add('-5 days'), dtend: NOW.add('3 days'), progress: 30, color: '#EACA76' });

	function selected(item, g) {
		console.log(item, g);
	}
</script>
```
