Comments (10)
The plugin actually recreates the table each time you do operations on it (changing page, filtering, sorting, etc.), so you cannot add extra row in the table.
However, if you wrap the row in a tbody
and the footer in a tfooter
, everything should work as expected!
from datatable.
How do you load the rows?
from datatable.
I load an array of objects. I "render" a view. In this view, I iter this array with a foreach, creating a row on each iteration:
`
<tr style="color: black;">
<td><?= $object->id ?></td>
<td>
<?php
if ($object->user->first_name !== null) {
echo $object->user->first_name . " " . $object->user->last_name;
} else {
echo "Sin Asignar";
}
?>
</td>
<td>
<?php
echo date("d M Y H:i:s", strtotime($object->date));
?>
</td>
<td><?= "$object->distance Km" ?></td>
<td>
<?php
setlocale(LC_MONETARY, 'es_CO');
if (function_exists("money_format")) {
echo money_format("%.0n", $object->total);
} else {
$fmt = new NumberFormatter('es_CO', NumberFormatter::CURRENCY);
echo $fmt->formatCurrency($object->total, "COP");
}
?>
</td>
</tr>
`
this last one row is out of the foreach and will show only an info:
<tr style="color: black;"> <td colspan=3""> </td> <td><strong>Total:</strong></td> <td> <?php setlocale(LC_MONETARY, 'es_CO'); if (function_exists("money_format")) { echo money_format("%.0n", $total); } else { $fmt = new NumberFormatter('es_CO', NumberFormatter::CURRENCY); echo $fmt->formatCurrency($total, "COP"); } ?> </td> </tr>
I apologize but the content is not loading all: the line for the foreach is not loaded but looks like: foreach($objects as $object):
I forgot to mention: I am doing it in a WP plugin built by myself.
from datatable.
I thought you were loading data with AJAX, which you are not. Could you use the non-compressed file (without .min
) and show the error you get? Could you also show me the HTML table you get before using datatable (with pastebin or a gisthub)?
from datatable.
TypeError: rows[i].cells[j] is undefined datatable.js:135:17
Table structure validated without errors
All is made with a custom WP Plugin. WP 4.7.4, jQuery 1.12.4
from datatable.
I think the problem is the footer - The plugin is currently not really made to work with non-data rows unfortunately.
Could you try without the footer and see what you get?
from datatable.
Yes, you are right. I closed the table before the last one row, and this last one was put onto a new table and finally I could see the pagination and the table rows are showed as expected.
Thank you so much :)
from datatable.
Okay, this currently does not work, but this is not expected, so I am going to fix this ASAP so you can have a footer on your table!
from datatable.
@NestorAcevedo This should be fixed with latest commit so you can add a tfooter
and it will stay in place when the table is refreshed (tested with your table).
from datatable.
Ah ok, so if I put a tfooter it should work. I will do. Again, thank you and don't worry, is working. this last one will be a new feature and a great improvement for your plugin that many of us will thank :)
from datatable.
Related Issues (20)
- IE 11: Pagination and filter not working correctly HOT 2
- Inject data to table row HOT 4
- Nullpointer Exception table with filter and no data
- Not working on my project :( HOT 6
- CSS not work HOT 4
- Extract filtered records HOT 11
- Filter outside the table HOT 2
- No idea how to make filter outside table HOT 1
- Get number of a table row. HOT 6
- Update table data HOT 19
- Process Ajax Data Before Displaying on Table! HOT 3
- Using Filter/Sort with hidden child rows HOT 3
- Question: How to search/filter multiple columns with one search field HOT 2
- Was cleared all attributes from td. HOT 1
- Click in a row event HOT 3
- Filter by date mm/dd/yyyy HOT 1
- Ajax Doesn't Work HOT 4
- filter is not function after apply addRows HOT 2
- Table reload method HOT 2
- how can i implement for rowspan ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatable.