Using one model for two different Stores
First time posting! This is great because, so far, I have found Architect 2 and EXT to be very intuitive and easy to learn. Well done.
So here is my issue: I am using a single Model bound to two different Stores. One store fetches very basic data (Student name and ID) and the other store fetches detailed data (Address, Phone, Courses). However, the detail view shows all data and the server returns values under different names. So if I map to one, I lose the other. Example:
Basic data API returns: stnName, stnId
Detail data API returns: studentName, studentID
So what would my fieldName be for each of those?
Just an idea: Is there a way to change the field mapping before the API is called?
And, yes, I want to shoot the developer who made the API.
I would suggest including your details as a nested object in your data instead of hassling with 1 model for 2 different stores:
This is an interesting solution but is not ideal. I don't think that a Model should be designed around a single API. What would be cool is if the Store had the ability to map its fields to the Model fields. The default behavior would still exist, Models bound to Stores get populated with matched (or mapped within the Model) fields but if the Store has a mapping, it would be used instead.
Maybe I am just saying that Model field mappings should be moved to the Store?
Just some thoughts.
Tags for this Thread