- Selection
- Lamp → Chair
- Request argument
- record_id
- New panel
- Chair · 12 in stock
Some answers change more than text.
A name changes a heading. A selected product may change the whole section beneath it: availability, explanatory text and controls. Gramlot’s remote mechanism requests a Source fragment and mounts it as the content of an existing element.
On a Python host, Python builds that fragment. The browser renders the returned declarations using the same Source, binding and lifecycle machinery as the initial page.
Keep the selected value as the input.
This example uses the literal method name details. record_id is reactive, so a changed record requests another fragment. One request runs at a time; its answer replaces the target’s children. The first trigger during a request waits with its arguments, and further triggers are ignored while one is waiting.
The method can assemble ordinary declarations and reuse Python helpers. This is interface construction. If you only want a price or a status value, an endpoint called by dataRpc is the more direct mechanism.
details = pane.section("Waiting for the server")
details.remote("details", record_id="^.record_id")
@source
def details(self, root, record_id=None, **kwargs):
root.span(f"Record {record_id}")Read the explanation here. The working lesson and full contract are linked below.
Two useful kinds of response.
A Source method returns a piece of interface. An endpoint returns a value to put in Data. Those values can then update existing bindings. Knowing which kind of response you need keeps both your page and your host logic clear.
The gallery’s remote lesson makes this tangible: select Lamp, Desk or Chair and observe the name and stock in the rebuilt panel.
Choose the mechanism
You need to refresh only the available quantity. Do you have to rebuild the entire panel?
Reveal the explanation
No. Use a data response when only the value changes. Use remote when the requested result is a Source fragment.
Try the working example and read the full contract
KEEP EXPLORING