cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
520
Views
0
Helpful
1
Replies

ObservableDictionary - use and show

banikm.pt
Level 1
Level 1

hello,

I have few problems, after hours still don't know how to solve them.

First, how to use ObservableDictionary?

When I thy to insert key:value pairs to dict, there is only one key and one value in dict.

this.myData(new nx.data.ObservableDictionary());

this.myData().setItem({id: 1, value:'key_1'}, {id: 10, value: 'value_1'});

this.myData().setItem({id: 2, value:'key_2'}, {id: 10, value: 'value_2'});

this.myData().setItem({id: 3, value:'key_3'}, {id: 10, value: 'value_3'});

this.myData().setItem({id: 4, value:'key_4'}, {id: 10, value: 'value_4'});

and output:

this.myData().keys().toArray()

[Object

     id: 1

     value: "key_1"

     __proto__: Object]

this.myData().values().toArray()

[Object

     id: 10

     value: "value_4"

     __proto__: Object]

Second:

How to generate view from dictionary data? I have data model in following format:

key: {id, name}, value: [ {id, mode, ...}, {id, mode, ...}, ...]

I need to show this data in following format

- key1

     - id, mode, ...

     - id, mode, ...

     - ...

- key2

     - id, mode, ...

     - id, mode, ...

     - ...

- ...

Thank you so much.

1 Reply 1

banikm.pt
Level 1
Level 1

answer to first question:

     only string or number keys worked for me