Hi guys! So I have a question that stems from my a...
# tornadofx
n
Hi guys! So I have a question that stems from my attempt to make a Tornadofx application that utilizes clean MVVM architecture. Specifically my question is about where we put our actions? I have a View that uses a datagrid and displays a list of Cards. Each of the cards will have a load button on them that loads the specific view that they reference. My ViewModel looks like so
Copy code
class ProjectHomeViewModel: ViewModel() {
    private var projectUseCase = GetProjectsUseCase(Injector.projectDao)
    val items = FXCollections.observableArrayList<ProjectCard>()!!
    init {
        getProjects()
    }

    private fun getProjects() {
        projectUseCase.getProjects().subscribe {
            items.setAll(
                    it.map{
                        ProjectCard(it).apply{
                            loadProjectButton.action{

                            }
                        }
                    }
            )
        }
    }
}
my projectUseCase.getProjects() returns an Observable<List> which I subscribe to and map into the observableArrayList = items. I then use this items list inside my datagrid. basically, my question is, is it philosophically correct to have my ProjectCard's action present here in the viewModel? It works but i'm not sure if it's good/right...