$obj->_contactType = $contactType;
$obj->_DTparams['offset'] = ($params['page'] - 1) * $params['rp'];
$obj->_DTparams['rowCount'] = $params['rp'];
- if (isset($params['_raw_values']['sort'][0])) {
- // Will this work when CiviCRM is translated, as searching happens on the label column?
- // I can't find a place where the sort is added, but it should use the name, not the label.
- $sort = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['_raw_values']['sort'][0], 'column_name', 'label');
- $obj->_DTparams['sort'] = $sort . ' ' . $params['_raw_values']['order'][0];
+ if ($params['sortBy']) {
+ $obj->_DTparams['sort'] = $params['sortBy'];
}
list($fields, $attributes) = $obj->browse();
$fieldName = array('data' => $fieldName, 'cellClass' => $attributes[$fieldId][$id]['class']);
}
if (is_numeric($fieldId)) {
- $fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'label');
+ $fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'column_name');
CRM_Utils_Array::crmReplaceKey($value, $fieldId, $fName);
}
}
if (!empty($fieldIDs)) {
foreach ($fieldIDs as $fieldID) {
$headers[$fieldID] = ($this->_pageViewType == 'profileDataView') ? $customGroupInfo[$fieldID]['fieldLabel'] : $fieldLabels[$fieldID]['label'];
+ $headerAttr[$fieldID]['columnName'] = $fieldLabels[$fieldID]['column_name'];
}
}
$this->assign('dateFields', $dateFields);
<tr>
{if $pageViewType eq 'customDataView'}
{foreach from=$headers key=recId item=head}
- <th data-data={ts}'{$head}'{/ts}
+ <th data-data={ts}'{$headerAttr.$recId.columnName}'{/ts}
{if !empty($headerAttr.$recId.dataType)}cell-data-type="{$headerAttr.$recId.dataType}"{/if}
{if !empty($headerAttr.$recId.dataEmptyOption)}cell-data-empty-option="{$headerAttr.$recId.dataEmptyOption}"{/if}>{ts}{$head}{/ts}
</th>