Good day please help i cant get the rerender value from presenter i just want to add dynamic class
- simeon2022
- Member | 6
Good day please help i cant get the rerender value from presenter i just
want to add dynamic class after updating the order quantity
i just want to check if theres stock and then set backgroundcolor to red if
theres no stock
here is the snippet of the codes
- latte = https://paste.pics/…4d1144833689
- presenter = https://paste.pics/…4486a8c8fd48
- latte condition if no stock its show class red or else green refer on the #1 = https://paste.pics/…3698a72a8885
thanks i just need to get rid of this im asian dev i cant rid of this im new in nette framework i also read some docs in ajax and naja documentation thanks in advance
Last edited by simeon2022 (2022-11-29 11:09)
- Rick Strafy
- Nette Blogger | 55
Your snippet name is item-{some id}
not just item
,
right? So try sending also item id as itemId parameter to handle method and
redrawing 'item-' . $itemId'
. Also you'll need to reassign those
template variables in beforeRender or render<action> method, since order
how it's called is action<action> ⇒ handle<something> ⇒ render
methods.
- simeon2022
- Member | 6
Rick Strafy wrote:
Your snippet name is
item-{some id}
not justitem
, right? So try sending also item id as itemId parameter to handle method and redrawing'item-' . $itemId'
. Also you'll need to reassign those template variables in beforeRender or render<action> method, since order how it's called is action<action> ⇒ handle<something> ⇒ render methods.
thankyou for your quick response what do you mean by this ?
item-{some id}
not just item
, right?
correct me if im wrong so do you mean that i need to put that in my get request
ajax data ? thankyou
- simeon2022
- Member | 6
simeon2022 wrote:
Rick Strafy wrote:
Your snippet name is
item-{some id}
not justitem
, right? So try sending also item id as itemId parameter to handle method and redrawing'item-' . $itemId'
. Also you'll need to reassign those template variables in beforeRender or render<action> method, since order how it's called is action<action> ⇒ handle<something> ⇒ render methods.thankyou for your quick response what do you mean by this ?
item-{some id}
not justitem
, right?
correct me if im wrong so do you mean that i need to put that in my get request ajax data ? thankyou
here is what i did i put the id of the item in the data before sending it
to presenter
https://paste.pics/K3X6L
i also add the before render in the basepresenter https://paste.pics/K3X7P
its not yet work
- Rick Strafy
- Nette Blogger | 55
You code was pretty ok, don't put it in before render, just accept 1 more parameter in handle method and use redrawControl(‘item-’ . $itemId). Because your latte snippet https://paste.pics/…4d1144833689 is in foreach and named item-{$data->id}, so you need to redraw that exact name, not just item. If it won't work, make sure you are loading data from database to variables in render methods, not action/startup methods.
- Rick Strafy
- Nette Blogger | 55
You can also visit discord server https://discord.gg/azXxTbuQVq and get more help there, because I don't check forum often, only when discord notifies me there is a new post.
- simeon2022
- Member | 6
Rick Strafy wrote:
You code was pretty ok, don't put it in before render, just accept 1 more parameter in handle method and use redrawControl(‘item-’ . $itemId). Because your latte snippet https://paste.pics/…4d1144833689 is in foreach and named item-{$data->id}, so you need to redraw that exact name, not just item. If it won't work, make sure you are loading data from database to variables in render methods, not action/startup methods.
thankyou so much for your response i'm getting it to know more im still getting error but thanks for your idea i feel i can resolve maybe there are something i missed anyway thankyou again
Last edited by simeon2022 (2022-11-29 13:23)