question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storing objects in a field?

See original GitHub issue

Not so much of an issue, more a question: I’d like to store lists and objects in a field, is that possible?

For example, we have image uploads which always come as { uid, caption, url } object. We have single image uploads (e.g., a profile photo) or lists of uploads (e.g., photos on a blog post), which can be edited (i.e., adding, removing, changing the caption) in a form.

It doesn’t work setting the array or object directly in the field. Updates to the field (using field.set()) do not trigger a change in the form model.

Should I be using nested fields for this? If so, how would I specify a field containing a list with { uid, caption, url } objects in it, using unified notification?

What does work though is serializing the array or object to JSON and then putting this into the form. This is a bit inconvenient though.

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bvallantcommented, Mar 28, 2017

Well just as an update: Found out what the problem was… The component with the form was reinitialized for some weird reason which led also re-initializing the form and overwriting the updated value again. Though your hint @foxhound87 with using update() for nested fields was quite useful, thanks! 👍

1reaction
bvallantcommented, Mar 28, 2017

Oh sorry, that just happened when copying it over to GH… Well i’ll try to get it working somehow, but thanks for your help anyways!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# – Storing data inside objects (by using “fields”) - CodingBee
1st Approach: Store the data directly in an object, using “Fields” In this approach we have declared inside the employee class, that an ......
Read more >
How to store an object of variable type in a field in Java?
I was wondering if there was a way of storing a field that can be one of two possible object types, or another...
Read more >
Re: Store objects in custom fields - Marketing Nation - Marketo
We like to store this data as object within one custom field. From what I read the best way would be to use...
Read more >
Storing object data in a relational database
Naming when storing object data​​ All elements of the object model stored in the repository under the specified name. For example, since relational...
Read more >
How to store a Object in list with the fields that is required ...
Hi All, I have a custom object A with custom fields a__c,b__c and d__c. I'm storing a List<A> and sending this list to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found