Skip to main content

Ok, so what is the difference between data & dataMap and fields&fieldsMap and when would you use them? They seem to be very similar. Thank you

In a nutshell, the “map” version is just that, a Map (JavaScript object / associative array), rather than an ordered array / List.

data
is an ordered array of the rows in your Model, ordered by whatever “Order By” property you have set on your Model.
dataMap is a JavaScript object / Map of the rows in your Model, keyed by the row Id. We do NOT recommend that you inspect or modify dataMap directly, please use Model.getRowById(rowId) to find a row by it’s Id.

fields is an ordered array of the Fields you requested for your Model, ordered by the order in which you added them to the Model.
fieldsMap is a JavaScript object / Map of the Fields you requested in your Model, keyed by the Field API Name. We do NOT recommend that you inspect or modify fieldsMap directly, please use Model.getField(fieldAPIName) to find Field metadata by a Field’s API Name.

All of this is described in detail in the API docs for skuid.model.Model


Thank you!