Ticket #277 (closed defect: fixed)
Feature Request: generic way of keeping custom data in a control
| Reported by: | spheenik@… | Owned by: | xue |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0.3 |
| Component: | Prado Framework v3 | Version: | 3.0 |
| Severity: | feature | Keywords: | |
| Cc: |
Description (last modified by xue) (diff)
In Delphi, a TComponent has a property "Tag". It is used by developers to attach some non-framework-relevant data to it, one could also say, to tag it. Such a feature is missing from Prado currently, but could be easily added to TControl, as it is just one "define and forget"-property :)
Imagine a situation where I have multiple buttons, each letting me load a specific record from the database. I would tag the button with the primary key of the record, and could easily read the tag from the event handler to retrieve the record.
In Template I would have:
<com:TButton Tag="1" OnClick="clicked" /> <com:TButton Tag="2" OnClick="clicked" />
And in PHP:
public function clicked($sender, $param)
{
$db->retrieveByPK($sender->Tag);
...
}
Change History
Note: See
TracTickets for help on using
tickets.
