Phi: display property names with index
This commit is contained in:
parent
b60736ba7a
commit
3fbb25cde6
2 changed files with 9 additions and 2 deletions
|
@ -42,7 +42,7 @@
|
||||||
"></span>
|
"></span>
|
||||||
<span class="property-name"
|
<span class="property-name"
|
||||||
data-bind="
|
data-bind="
|
||||||
text: name,
|
text: indexedName,
|
||||||
css: {
|
css: {
|
||||||
'pointer-icon': hasChildren,
|
'pointer-icon': hasChildren,
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,7 @@ define([
|
||||||
function load() {
|
function load() {
|
||||||
jquery.get('/json' + self.path, null, function(data) {
|
jquery.get('/json' + self.path, null, function(data) {
|
||||||
self.hasChildren = data.nChildren > 0;
|
self.hasChildren = data.nChildren > 0;
|
||||||
|
self.index = data.index;
|
||||||
if (typeof (data.value) != 'undefined') {
|
if (typeof (data.value) != 'undefined') {
|
||||||
self.value(data.value);
|
self.value(data.value);
|
||||||
self.hasValue = true;
|
self.hasValue = true;
|
||||||
|
@ -22,6 +23,7 @@ define([
|
||||||
var p = new PropertyViewModel();
|
var p = new PropertyViewModel();
|
||||||
p.name = prop.name;
|
p.name = prop.name;
|
||||||
p.path = prop.path;
|
p.path = prop.path;
|
||||||
|
p.index = prop.index;
|
||||||
p.hasChildren = prop.nChildren > 0;
|
p.hasChildren = prop.nChildren > 0;
|
||||||
if (typeof (prop.value) != 'undefined') {
|
if (typeof (prop.value) != 'undefined') {
|
||||||
p.value(prop.value);
|
p.value(prop.value);
|
||||||
|
@ -49,6 +51,11 @@ define([
|
||||||
self.hasChildren = false;
|
self.hasChildren = false;
|
||||||
self.hasValue = 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 = ko.observable(false);
|
||||||
self.isExpanded.subscribe(function(newValue) {
|
self.isExpanded.subscribe(function(newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
|
|
Loading…
Reference in a new issue