Best Practice - Getting access to checkbox component within ember-table from another component

Hi there.

Just hoping to get some feedback on what the best approach is for a situation like this.

I am trying to implement a column with a checkbox in a table created with ember-table ( forked version of it with some personal enhancements but the base is basically the same) that is within a component.

The checkbox-cell that is rendered is basically a component of its own . The purpose of this check box is to act as some sort of flag to determine if the row should be included for processing.

I have another component that is a button when clicked , will build an array of Ids of all the rows within the table that has been checked.

How would the state of the checkbox and ID value of the row be available from another component ? It is not part of the model and components are stand alone isolated from each other.

All the components are used as part of the same route.

Thanks.

At first glance, there are two ways.

First way, you send an action up whenever the checkbox changes value. The parent route/component receives that action, then sends data back down to the other component. This is probably the best way based on limited understanding of your use.

Second way, if you need to store a value globally, use services. Services can be injected into anything (routes, controllers, components, etc) and maintain state across the board. I would only go this route as a last resort though as I think this would be overkill and bad design for your simple use case.