Commit ff6eec68 authored by Peter Lundin's avatar Peter Lundin
Browse files

Some functions work

parent a8f01407
......@@ -65,7 +65,7 @@
</div>
<form class='cmdbguiSearchForm'>Sök:<input type="text" name="searchString" id="searchString"/></form>
<p class='cmdbguiSmallText'>Innehåll</p>
<div id="displayarea"></div>
<div id="cmdb-table"></div>
<p class='cmdbguiSmallText'>Relationer</p>
<div id="mynetwork"></div>
</body>
......
This diff is collapsed.
subOrg1: {
title: '',
width: '1%',
sorting: false,
edit: false,
create: false,
delete: false,
display: function(data){
var $imgSubOrg = $('<img src="/images/organisation.png" title="Nivå 2" />');
$imgSubOrg.click(function () {
$('#displayarea').jtable('openChildTable', $imgSubOrg.closest('tr'),{
title: 'Organisation nivå 2',
showCloseButton: false,
actions: {
listAction: '/cmdb/api/v1/organisation/list/5' , // select all rows with parent === data.record.id
},
fields: {
closeChild: {
title: '',
width: '1%',
sorting: false,
edit: false,
create: false,
delete: false,
display: function(){
var $imgClose = $('img src="/images/cross.png');
$imgClose.click(function() {
$('#displayarea').jtable('closeChildTable', $($imgClose.closest('tr')));
});
return $imgClose;
}
},
id: {
title: 'id',
width: '15%',
list: false,
key: true
},
display_name: {
title: 'Namn',
width: '15%'
},
description: {
title: 'Beskrivning',
width: '30%'
},
organisation_type: {
title: 'Typ',
options: '/cmdb/api/v1/organisation/types',
width: '15%'
},
organisation_level: {
title: 'Nivå',
options: '/cmdb/api/v1/organisation/levels',
width: '15%'
},
parent_organisation_id: {
list: false,
title: 'Överordnad organisation',
options: '/cmdb/api/v1/organisation/parents',
width: '15%'
}
},
},
function(data){
data.childTable.jtable('load');
});
});
return $imgSubOrg;
}
},
$(document).ready(function () {
$('#displayarea').jtable({
$('#cmdb-table').jtable({
title: "Organisation",
paging: false, //Enable paging
pageSize: 10, //Set page size (default: 10)
pageList: 'minimal',
sorting: true, //Enable sorting
multiSorting: true,
sorting: false, //Enable sorting
multiSorting: false,
defaultSorting: 'display_name ASC', //Set default sorting
actions: {
listAction: '/cmdb/api/v1/organisation/list/0',
......@@ -39,31 +39,16 @@ $(document).ready(function () {
create: false,
delete: false,
display: function(data){
display: function(parentOrganisation){
var $imgSubOrg = $('<img src="/images/organisation.png" title="Nivå 2" />');
$imgSubOrg.click(function () {
$('#displayarea').jtable('openChildTable', $imgSubOrg.closest('tr'),{
title: 'Organisation nivå 2',
showCloseButton: false,
$('#cmdb-table').jtable('openChildTable', $imgSubOrg.closest('tr'),{
title: parentOrganisation.record.display_name + ':s underliggande organisationer',
showCloseButton: true,
actions: {
listAction: '/cmdb/api/v1/organisation/list/' + data.record.id, // select all rows with parent === data.record.id
listAction: '/cmdb/api/v1/organisation/list/' + parentOrganisation.record.id , // select all rows with parent === data.record.id
},
fields: {
closeChild: {
title: '',
width: '1%',
sorting: false,
edit: false,
create: false,
delete: false,
display: function(){
var $imgClose = $('img src="/images/cross.png');
$imgClose.click(function() {
$('#displayarea').jtable('closeChildTable', $($imgClose.closest('tr')));
});
return $imgClose;
}
},
id: {
title: 'id',
width: '15%',
......@@ -94,7 +79,7 @@ $(document).ready(function () {
options: '/cmdb/api/v1/organisation/parents',
width: '15%'
}
},
}
},
function(data){
data.childTable.jtable('load');
......@@ -135,14 +120,6 @@ $(document).ready(function () {
}
}
});
//Re-load records when user click 'load records' button.
$('#displayarea').click(function (e) {
e.preventDefault();
$('#displayarea').jtable('load');
});
//Load all records when page is first shown
$('#displayarea').click();
$('#cmdb-table').jtable('load');
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment