Hello there!
I need your help in probably small thing.
Firstly I just want to add that I’ve builded my app with MeteorKitchen, so the code could look different than normal code
I have a “dropdown” in my app and I want to take the data from checked option. Of course I want it to be changeable (if I change my check option, the data should be changed as well). I want to have the same info style as is on the left on my right side under “TO” dropdown.
I fast copied some of my old code, dont know if it is working as expected
Used Session there, good old antipattern times
Use console.log there to debug if it is handled correctly.
Regarding that Session, it is not best pattern to keep state in it.
So have a look on this article how to migrate it to nice Template level reactive variable
I have one last problem here.
When I check one option and do “save” the invoice, I go to other invoice and edit that. My “customer data” isn’t the same as the customer I’ve chosen
well, that is based on that meteor kitchen code I expect, it does not select the chosen value form previous screen, but probably use the 1st value there.
You would probably need to manually need to add check there to add selected property to given customer
I’ve change “numberone” to “klient”. Do I need to add "{{optionIsSelected ../invoice_edits.customerId _id}" next to {{klient.xxx}} ?
of course that line "{{ klient.name}}; {{optionIsSelected ../invoice_edits.customerId klient.name}}" doesn not work.
well, depends what that _id in #each customers represents, cause it seems that to get collection _id or something like that you need to transform it using that ../invoice_edits.customerId helper from parent template
Or at least it looks that way from my point of view. I am not expert.
without seeing helpers for these it is kinda hard to comment
I dont know, first you pasted some code snippet.
Now you are pasting other version with some optionIsSelected helper… (with some strangely looking arguments, cause in spacebars they are evaluated as “helper1 helper2 data” as long as I know)
I am surrendering to this when facts are still changing.
Sorry for that.
I use the same code on tho sites - “new invoice” and “edit invoice”, so that’s why I used my “edit invoice” code now - where I want to see the data to change.
Everygthing is the same, so you don’t need to feel confused
Sooo… I set a session in “new invoice” and that’s all. I need to set new page session in “edit invoice”? Or read the session from “new”? I need to load the data from the database (memory) and if that is checked - the data on screen should change as well.