function fetchRow(&$args, $request)
{
// Instantiate the requested row (includes a
// validity check on the row id).
$row = $this->getRequestedRow($request, $args);
$json = new JSONMessage(true);
if (is_null($row)) {
// Inform the client that the row does no longer exist.
$json->setAdditionalAttributes(array('elementNotFound' => $args['rowId']));
} else {
// Render the requested row
$renderedRow = $this->renderRow($request, $row);
$json->setContent($renderedRow);
// Add the sequence map so grid can place the row at the correct position.
$sequenceMap = $this->getRowsSequence($request);
$json->setAdditionalAttributes(array('sequenceMap' => $sequenceMap));
}
$this->callFeaturesHook('fetchRow', array('request' => &$request, 'grid' => &$this, 'row' => &$row, 'jsonMessage' => &$json));
// Render and return the JSON message.
return $json;
}