Class QHtmlTableLinkColumn
Class QHtmlTableLinkColumn
A multi-purpose link column. This column lets you specify a column whose purpose is to show an anchor tag with text, attributes and properties related to row item. It can handle row items that are objects or arrays, and specify parameters or methods of objects, as well as offsets in arrays.
You can specify the text of the link, the destination address, the html get variables, and the attributes to the anchor tag in a variety of ways as follows: - as a static string - as a two member array callable, with the row item passed to the callable - as an object property or string of properties (i.e. $item->prop1->prop2) by starting the string with "->" and separating each property with a "->". If the property ends with "()", then it will be a method call instead. The same can be accomplished by passing an array, with each item being a step in the property chain. This is provided the row item is an object. - as an index into an array, or a multi-index array (i.e. $item['index1']['index2']) by passing a string of the form "[index1][index2]...". You can also pass an array that contains the indexes into the array. This is provided the row item is an array.
Other options: - Specify null for $mixDestination, and no link will be created, just text. This is helpful for turning off the link mode without having to create a completely different kind of column. - Specify a QControlProxy for $mixDestination to draw it as a proxy control. In this case, $blnAsButton can be used to draw the proxy as a button rather than a link.
Examples: Create a column to edit a person, with "Edit" in the header, the name of the person as the label of each link, and give each anchor a class of "link". $objColumn = new QHtmlTableLinkColumn ("Edit", "->Name", "person_edit.php", ["intId"=>"->Id"], ["class"=>"link"]);
Create a similar column, but use a proxy instead, with the person id as the action parameter to the proxy and drawing the proxy as a button. $objProxy = new QControlProxy($this); $objColumn = new QHtmlTableLinkColumn ("Edit", "Edit", $objProxy, "->Id", null, true); Create a "zoom" column for a table that uses an array of arrays as its source. Pass the 'id' index from the item as the id to the destination link. Use the "title" index as the label for the link. $objColumn = new QHtmlTableLinkColumn ("Zoom", "[title]", "zoom.php", ["intId"=>"[id]"]); Create a simple link column that just specifies a data attribute, and uses event delegation attached to the table to trap a click on the link. Return the id of the item clicked to the action as the action parameter. $objTable = new QHtmlTable ($this); $objTable->CreateLinkColumn("", "->Name", "#", null, ["data-id"=>"->Id"]); $objTable->AddAction(new QClickEvent(0, null, "a"), new QAjaxAction("myActionScript", null, null, '$j(this).data("id")'));
- QBaseClass
- QAbstractHtmlTableColumn
- QAbstractHtmlTableDataColumn
- QHtmlTableLinkColumn
public
|
#
__construct( string $strName, null|string|array|
QHtmlTableLinkColumn constructor. |
protected static
mixed
|
|
protected static
string
|
#
GetObjectValue( mixed $mixSpec, mixed $item )
Utility function to post-process a value specifier. Will walk through an object property chain or an array index chain and return the final value. |
public
string
|
#
FetchCellObject( mixed $item )
Returns the initial text that will be the label of the link. This text can be further processed by using the inherited PostCallback function and similar properties. |
public
string
|
|
public
|
|
public
|
|
public
boolean|integer|mixed|
|
|
public
mixed|
|
OverrideAttributes(),
__call()
|
protected
boolean
|
$blnHtmlEntities
|
#
false
|
protected
string|array
|
$mixText
|
|
protected
string|array| |
$mixDestination
|
|
protected
array|string|null
|
$getVars
|
|
protected
array|null
|
$tagAttributes
|
|
protected
boolean
|
$blnAsButton
|
$objOrderByClause,
$objPostCallback,
$objReverseOrderByClause,
$strFormat,
$strPostMethod
|
$blnRenderAsHeader,
$blnVisible,
$cellParamsCallback,
$intSpan,
$objCellStyler,
$objColStyler,
$objHeaderCellStyler,
$objParentTable,
$strCssClass,
$strHeaderCssClass,
$strId,
$strName
|
public
boolean
|
$AsButton
Only used if this is drawing a QControlProxy. Will draw the proxy as a button. |
public write-only
null|string|array
|
$Text
The text to display as the label of the anchor, a callable callback to get the text, a string that represents a property chain or a multi-dimensional array, or an array that represents the same. Depends on what time of row item is passed. |
public write-only
null|string|array| |
$Destination
The text representing the destination of the anchor, a callable callback to get the destination, a string that represents a property chain or a multi-dimensional array, or an array that represents the same, or a QControlProxy. Depends on what time of row item is passed. |
public write-only
null|string|array
|
$GetVars
An array of key=>value pairs to use as the GET variables in the link URL, or in the case of a QControlProxy, possibly a string to represent the action parameter. In either case, each item can be a property chain, an array index list, or a callable callback as specified above. |
public write-only
null|array
|
$TagAttributes
An array of key=>value pairs to use as additional attributes in the tag. For example, could be used to add a class or an id to each tag. |
$Format,
$OrderByClause,
$PostCallback,
$PostMethod,
$ReverseOrderByClause
|
$CellParamsCallback,
$CellStyler,
$ColStyler,
$CssClass,
$HeaderCellStyler,
$HeaderCssClass,
$HtmlEntities,
$Id,
$Name,
$ParentTable,
$RenderAsHeader,
$Span,
$Visible,
$_ParentTable
|