Sometimes you may want to create buttons, links or other HTML items which can "trigger" a Server or Ajax
action without actually creating a QControl. The typical example of this is if you want to dynamically
create a large number of links or buttons (e.g. in a DataGrid or DataRepeater) which would trigger
an action, but because the link/button doesn't have any other state (e.g. you'll never want to
incur the overhead of creating a whole Control for each of these links or buttons.
The way you can do this is by creating a Proxy on your Form, and attaching
it to a link, button or other html item by rendering it specially.
The example below illustrates the manual creation (see the code for more information) of a list of
links which makes use of a single Proxy to trigger our event. Notice that while there are many links
and buttons which each trigger Ajax-based Actions, there is actually only 1 Proxy
defined to handle all these events.
Proxys can be rendered as links...
Or embedded in any kind of tag.
Test 2 |