Jquery DataTables not working when am using a foreach loop
Jquery DataTables not working when am using a foreach loop
dula
Posts: 3Questions: 1Answers: 0
My Jquery DataTables is not working when am using a foreach loop to display data on a table in multiple bootstrap tabs. Here is my code
<table class="table table-bordered display" id="dailyentriesList">
<thead>
<tr>
<?php if (isset($this->items[0]->state)): ?>
<?php endif; ?>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_EXCEL_DATE', 'a.date', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_PAGE_VIEWS', 'a.pageviews', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_IMPRESSIONS', 'a.impressions', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_CLICKS', 'a.clicks', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_PAGE_RPM', 'a.pagerpm', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_IMPRESSION_RPM', 'a.impressionrpm', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_ACTIVE_VIEW_TABLE', 'a.activeviewtable', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo JHtml::_('grid.sort', 'COM_ADSENSEREPORTING_DAILYENTRIESS_ESTIMATED_EARNINGS', 'a.earnings', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="<?php echo isset($this->items[0]) ? count(get_object_vars($this->items[0])) : 10; ?>">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php $canEdit = $user->authorise('core.edit', 'com_adsensereporting'); ?>
<tr class="row<?php echo $i % 2; ?>">
<?php if (isset($this->items[0]->state)) : ?>
<?php $class = ($canEdit || $canChange) ? 'active' : 'disabled'; ?>
<?php endif; ?>
<td>
<?php echo $item->date; ?>
</td>
<td>
<?php echo $item->pageviews; ?>
</td>
<td>
<?php echo $item->impressions; ?>
</td>
<td>
<?php echo $item->clicks; ?>
</td>
<td>
<?php echo $item->pagerpm; ?>
</td>
<td>
<?php echo $item->impressionrpm; ?>
</td>
<td>
<?php echo $item->activeviewtable; ?>
</td>
<td>
<?php echo $item->earnings; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page], if you can't provide a link to your own page can be found here.
Thanks,
Allan
In order for you to see the page one has to login..bc it fetches data from the db...
You can drop me a PM by clicking my name above and then "Send message".
Allan
Okay. Sure thing