Here’s one situation:
Product list view
- Editable list of Products
- Want to show a “Total quantity owned” field (can be Ui only) that is really an aggregate of a stock object
- Create aggregate model on Stock grouping by Product, summing Quantity
- Create JS field render that does a for loop on my aggStock model
- Compare the field being rendered to each field in aggStock, if the Id’s match up, pull the aggQuantity field and append it using a field render. If no matches are found, put a 0 for quantity.
- Apply custom field render on my quantity field
Would it be better to:
- Have a condition on my aggStock model where Product Id = null and set that condition value in the field render using JS?
- Create an array of all of the Ids in my aggStock model by looping all of the fields, then using .indexOf to find that specific row’s position in the array and pull info from there?
- Is there something glaringly obvious that I’m missing?