list($fields, $attributes) = $obj->browse();
- // format params and add links
+ // format params and add class attributes
$fieldList = array();
foreach ($fields as $id => $value) {
$field = array();
$field = $value;
array_push($fieldList, $field);
}
+ $totalRecords = !empty($obj->_total) ? $obj->_total : 0;
$fieldList = array_map('array_merge', $fieldList);
$multiRecordFields = array();
$multiRecordFields['data'] = $fieldList;
- $multiRecordFields['recordsTotal'] = $obj->_total;
- $multiRecordFields['recordsFiltered'] = $obj->_total;
+ $multiRecordFields['recordsTotal'] = $totalRecords;
+ $multiRecordFields['recordsFiltered'] = $totalRecords;
CRM_Utils_JSON::output($multiRecordFields);
}
$DTparams = !empty($this->_DTparams) ? $this->_DTparams : NULL;
// commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView)
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE, $DTparams);
- $resultCount = $result['count'];
+ $resultCount = !empty($result['count']) ? $result['count'] : count($result);
unset($result['count']);
if ($this->_pageViewType == 'profileDataView') {
var defaults = {
"processing": true,
"serverSide": true,
+ "aaSorting": [],
"dom": '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"pageLength": 25,
"drawCallback": function(settings) {
{else}
{assign var='dialogId' value='profile-dialog'}
{/if}
- {if $records and $headers}
+ {if ($records and $headers) or ($pageViewType eq 'customDataView')}
{include file="CRM/common/jsortable.tpl"}
<div id="custom-{$customGroupId}-table-wrapper" {if $pageViewType eq 'customDataView'}class="crm-entity" data-entity="contact" data-id="{$contactId}"{/if}>
<div>
"ajax": {
"url": {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal},
},
- "aaSorting": [],
- "pageLength": 10,
"language": {
- "zeroRecords": ZeroRecordText,
+ "emptyTable": ZeroRecordText,
},
//Add class attributes to cells
"fnRowCallback": function(nRow, aData) {
$('thead th').each( function( index ) {
var fName = $(this).attr('data-data');
var cell = $('td:eq(' + index + ')', nRow);
- if (typeof aData[fName]=='object'){
+ if (typeof aData[fName]=='object') {
if (typeof aData[fName].data != 'undefined') {
$(cell).html(aData[fName].data);
}