1
0
Fork 0

Phi: display property names with index

This commit is contained in:
Torsten Dreyer 2015-02-27 16:49:19 +01:00
parent b60736ba7a
commit 3fbb25cde6
2 changed files with 9 additions and 2 deletions

View file

@ -42,7 +42,7 @@
"></span>
<span class="property-name"
data-bind="
text: name,
text: indexedName,
css: {
'pointer-icon': hasChildren,
},

View file

@ -8,6 +8,7 @@ define([
function load() {
jquery.get('/json' + self.path, null, function(data) {
self.hasChildren = data.nChildren > 0;
self.index = data.index;
if (typeof (data.value) != 'undefined') {
self.value(data.value);
self.hasValue = true;
@ -22,6 +23,7 @@ define([
var p = new PropertyViewModel();
p.name = prop.name;
p.path = prop.path;
p.index = prop.index;
p.hasChildren = prop.nChildren > 0;
if (typeof (prop.value) != 'undefined') {
p.value(prop.value);
@ -49,6 +51,11 @@ define([
self.hasChildren = false;
self.hasValue = false;
self.indexedName = ko.pureComputed(function() {
if( 0 == self.index ) return self.name;
return self.name + "[" + self.index + "]";
});
self.isExpanded = ko.observable(false);
self.isExpanded.subscribe(function(newValue) {
if (newValue) {