Hey im new to cairngorm
How do i pass data back from the command ie from the onResult() in the command back to the component the called it
I know how to put the data in the model, but it is my impression that this is only for data that you want to store and reference in many places
with i have done with some querys
This query however is just a product search result so don't need it to be stored in the model just sent back and displayed in a grid
There's no inbuild facility to reach views from within Commands in C3 Integration lib, nor in Parsley 2.2. You could of course inject them into Commands. However, I don't see the extra effort in separating your concerns slightly better and creating a model, do you?
im afraid i dont quite understand you. Do u mean that i should not worry about putting this temp data in the model? Or are u saying that i should create another model to store the data - is that possible. sorry as i mentioned i am new to cairngorm as i only started yesterday
Yes, I would probably favour creating a model in most real-world cases. Check out the tutorials and sample apps in the Introduction section of the Cairngorm guidelines to learn more.
i have a model but this is not always applicable .
what happens when you have a form that creates somehting in the db and the only thing returned in a boolean to indicate that the row has been created and all i want to do is close the window when the operation is complete?
Yes I am having a similar problem.
I need the UI to respond to data being loaded. I know I can Bind data and all of that but I don't need to display the data I just want the interface to change once the data has loaded.
Obviously if I was doing this from scratch I would trigger an event the the GUI listens for but how do I do that from a controller??
OK, I have done some looking around and found a possible solution. I am not sure if its pure Cairngorm or MVC but it seem to work for me so here we go
You can have more than 1 Model. You can have as many as you require grouping you data in logical collections. These should always be Bindable.
Then in my case You have a creationComplete event in you main application file that tells a command to load data in the usual Cairngorm way. This data is then passed to and ArrayCollection in the Model
What I am then doing (rightly or wrongly) is adding an event listener in the main app file that listens for the ArrayCollectio to change (CollectionEvent.COLLECTION_CHANGE) and then trigger another event.
I suppose you could get more complex and have a Boolean variable in the Model that just states if data was loaded correct and the app file listens for that to change.
I guess I am treating the concept of Models as not just a place to store your data but also all variables that need to be globally accessed. As I said I have now idea if this is proper MVC or the correct use of Cairngorm but it works for me.
I hope that’s clear and not just a load of garbage ;-)
OK, finally check this link out
Hey thanks for all that your totally awesome!
Using the link u provided and the example that are are in the source files for carigorm iv been finally able to get the command to call the view
Such a shame that this has been such a struggle , maybe others don't have the same problems in understanding and getting the solution for this problem as i have but why there cant be examples on the carigorm site to address this problem i don't know
Yes I agree. I also would have thought it would be an issue that more people would face than there seem to be.
I have heard critism that Cairngorm relies too much on Data Binding. I guess many developer just listen for data changes to notify the View but like you said this seem a little cluncky to me and can soon become very complex.
Anyway glad I could help a little bit.
Europe, Middle East and Africa