Phi: display property names with index
This commit is contained in:
parent
b60736ba7a
commit
3fbb25cde6
2 changed files with 9 additions and 2 deletions
|
@ -40,9 +40,9 @@
|
|||
},
|
||||
click: toggle,
|
||||
"></span>
|
||||
<span class="property-name"
|
||||
<span class="property-name"
|
||||
data-bind="
|
||||
text: name,
|
||||
text: indexedName,
|
||||
css: {
|
||||
'pointer-icon': hasChildren,
|
||||
},
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue