Using a QControlProxy to Receive Events
Sometimes you may want to create buttons, links or other HTML items which can "trigger" a Server or Ajax
action without actually creating a control. The typical example of this is if you want to dynamically
create a large number of links or buttons (e.g. in a QDataGrid
) 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 QControl
for each of these links or buttons.
The way you can do this is by creating a QControlProxy
on your QForm
, and having
any manually created links or buttons make hard-coded RenderAsEvents()
method calls to
trigger your action/event.
The example below illustrates the manual creation (see the code for more information) of a list of
links which makes use of a single QControlProxy
to trigger our event. Notice that while there are 4 links
and 4 buttons which each trigger Ajax-based Actions, there is actually only 1 QControl
(which of course is
control itself) defined to handle all these events.