Skip to Content
Menu
This question has been flagged
2 Replies
199 Views

Hello!

I have a result in jsonStrssEM like this

{"days":[{"day":"1","hours":"14","nature":"T"},{"day":"2","hours":"24","nature":"T"},{"day":"3","hours":"34","nature":"T"},{"day":"4","hours":"44","nature":"T"}]}

{"days":[{"day":"1","hours":"4","nature":"T"},{"day":"2","hours":"4","nature":"T"},{"day":"3","hours":"3","nature":"T"},{"day":"4","hours":"10","nature":"T"}]}

and i want to do this:

self.field_manager.set_values({
                        "horraire_data": jsonStrssEM,
                        });

can any one help me to know how _.each function works to be able to apply the self.field_manager.set_values for result which contains multiple resukts as shown please .

Avatar
Discard
Best Answer

Hi,

You can try the below code :

self.field_manager.horraire_data = jsonStrssEM

or you can try :

self.field_manager['horraire_data'] = jsonStrssEM

or 

self.field_manager[horraire_data] = jsonStrssEM

 

Avatar
Discard
Author Best Answer

Thanks a lot for your answer but it doesnt work. I have tried them.

What i get in my data base through the first and the second solution is {}

and for the third one i get an error .

Can you explain to me how to use _.each of underscore.js??!!

 

Avatar
Discard