Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Feature Request: Load existing nested value from remote #658

Open
@antony

Description

@antony

Hi.

I've encountered a pretty critical problem when using this control in an edit-form.

I was, previously - using the id of my customer objects in a document. The customers were loaded using the refresh=" function()" feature. This works fine for fresh new data. To make this clear, I was using "customer._id as customer in customers".

If you then re-populate the field using an ID of a remote object (i.e. a mongo document), as you might do if editing a record, none of the information (i.e. my control needs to show the customer full name, not the id) is visible to the user because it simply doesn't exist. The solution is to reload the whole customer from the database and populate the control that way.

Therefore you end up with a detached object, which appears fine to the user, but when it comes to saving - the field is populated with the whole object rather than just the id - which makes saving very difficult. Lots of manual mapping from documents to ids is required.

What my poposed solution is, is that if you give the control an id, and the object does not exist in the array populated by refresh="", then the control automatically calls the refresh function with the required information to populate the control with all the required information, i.e. full name, id. HOWEVER - because it's done by the control instead of assigning the model directly, the value of the model is still correct - i.e. just the ID on its own. The dropdown however shows the customer's full name.

This would make the control's behaviour much more consistent when using 'customer._id as customer'

Does this make sense or is a Plunker needed?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions