Skip to content

Commit

Permalink
Actions can now have an additional field id
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Apr 8, 2015
1 parent fba347c commit ed01450
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions js/src/treegrid/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ CHAP Links Library - TREEGRID
http://almende.github.com/chap-links-library/


2015-04-08, version 1.6.0

- Actions can now have an additional field `id`.


2015-04-07, version 1.5.0

- Implemented selective drag and drop: the DataConnector where the items
Expand Down
7 changes: 7 additions & 0 deletions js/src/treegrid/doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,13 @@ <h3><a name="Special_fields" id="Special_fields"></a>Special fields</h3>
<td>The height of the action icon or text, for example '32px'.</td>
</tr>

<tr>
<td>id</td>
<td>*</td>
<td>no</td>
<td>An id for the action.</td>
</tr>

<tr>
<td>image</td>
<td>String</td>
Expand Down
6 changes: 3 additions & 3 deletions js/src/treegrid/examples/example05_events_and_actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'name': 'Department ' + chars.charAt(index),
'employees': personCount,
'sales': '$ ' + (10 + personCount * 10 * Math.round(7 * Math.random())) + '.000'
}
};
department.persons = createPersons(personCount);
department._actions = [
{'event': 'delete', 'title': 'Delete this department', 'image': 'img/24/Close-2-icon.png'}
Expand All @@ -63,12 +63,12 @@
return new links.DataTable(departments);
}

function createPerson(index, count) {
function createPerson(index) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var person = {
'name': '<img src="img/24/Preppy-icon.png" class="icon"> Person '+ chars[index],
'age': Math.round(20 + Math.random() * 40)
}
};

person._actions = [
{'event': 'edit', 'image': 'img/24/Document-Write-icon.png'},
Expand Down
2 changes: 2 additions & 0 deletions js/src/treegrid/treegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ links.TreeGrid.Node.createActionIcons = function (node, actions) {
domAction.title = action.title || '';
domAction.src = action.image;
domAction.event = action.event;
domAction.id = action.id;
domAction.item = node;
domAction.style.width = action.width || '';
domAction.style.height = action.height || '';
Expand All @@ -519,6 +520,7 @@ links.TreeGrid.Node.createActionIcons = function (node, actions) {
domAction.title = action.title || '';
domAction.innerHTML = action.text ? action.text : action.event;
domAction.event = action.event;
domAction.id = action.id;
domAction.item = node;
domAction.style.width = action.width || '';
domAction.style.height = action.height || '';
Expand Down

0 comments on commit ed01450

Please sign in to comment.