0 Replies Latest reply on Aug 20, 2007 2:20 AM by sburkard

    Rendering Querydata in nested Custom-Tags

    sburkard
      Hi all

      I have built two custom-tags to render the results of a query in a table (a bit like the display-tag-library or the datatable-tag of JSF). the parent tag takes the query as attributes as well as some other things like records per page.

      the child-tag defines a single column. the developer can define a query-column-name in an attribute as well as the label and so on.
      the typical code looks like this and this works fine:

      <tags:dataTable collection="#AddressQuery#" basePath="#link.list#">
      <tags:dataTableColumn column="id" label="" selection="true" />
      <tags:dataTableColumn column="name" label="Name" sortable="true" />
      <tags:dataTableColumn column="street" label="Strasse" sortable="true" />
      <tags:dataTableColumn column="houseNumber" label="Hausnummer" sortable="true" />
      <tags:dataTableColumn column="isEnabled" label="Aktiv" sortable="false" />
      </tags:dataTable>

      Now, I'd like to allow the developer to write custom code to generate the content of a table column. For example show the value of a bit-field with icons:
      <tags:dataTableColumn label="my bit-column">
      <cfif #columnname# gt 0>[display image "active"]<cfelse>display image "inactive"</cfif>
      </tags:dataTableColumn>

      Unfortunately, this throws an error because the variable of the querycolumnname can't be resolved when the tag-content is executed (the query-loop is done when the parent's end-tag is processed).

      Can I prevent CF to execute the tag-content, but instead save the code of the developer and execute it later when processing the endtag of the parent?
      If not can I solve this problem otherwise?

      thanks
      stefan