Print endRender of rowGroup
Print endRender of rowGroup
antoniocib
Posts: 277Questions: 62Answers: 1
Hi guys should I have a table with the rowGroup function when I press the print button how do I get the endRender row printed too ?
Answers
The RowGroup Known Limitations state this:
Kevin
Kevin one solution for this exist or i cant do anythings?
If there was a solution, it would be supported
Search the forum, there are a few threads where people have offered workarounds, such as here and here.
Colin
@kthorngren kevin after i add this show me a button, but this when I click it, it starts spinning and it doesn't stop but it doesn't open anything...
There are the my libraries
return me this error when i click pdf button:
Hi @kthorngren and @colin I was able to make the pdf file grouped by this code but I have no idea now how to add the rowGroup endRender in the pdf file.
pdf button code:
rowGroup code:
Without actually being able to work with the code it is hard to say. Please put together a simple example using http://live.datatables.net/. We don't need your exact data. A simple endRender will suffice.
Kevin
@kthorngren for me is more easy link my code as i do always, okay?
http://damoratraffico.netsons.org/rowGroup/scrivania1.html
Its difficult for us to work with and debug since we can make changes. Maybe someone more familiar with PDF export can look at your code and see the probblem.
Kevin
So what i do Kevin?
Start with this example from your previous thread:
http://live.datatables.net/toqomaxo/1/edit
Update the JS and CSS files to use the CDN you listed above. Add your buttons config. It should chow the RowGroups and your buttons and be a working example.
Kevin
So i must to copy and paste my code in this "virtual table"?
http://live.datatables.net/toqomaxo/3/edit @kthorngren
It took awhile to get the test case running. Needed to update the JS and CSS and fix the arrays to match the number of columns in the table. Next time please make sure the test case runs so we can spend our time helping with the problem.
I changed the code a bit to put the column value at the end of the group instead of the beginning.
http://live.datatables.net/toqomaxo/4/edit
Kevin
I'm so sorry Kevin, and I don't know how this test case works, I just didn't know how to make it work... my fault!
Now i try to work it thanks for ur time!
Hi @kthorngren I tried the code and it's identical to yours but I'm getting this mistake again what is it I don't understand?
Uncaught TypeError: Cannot create property 'positions' on string'.
https://damoratraffico.netsons.org/rowGroup1/scrivania1.html
My guess is its this line:
bod.push([{text:endRenderText, style:'tableHeader'},'','','','','','','','','','','','','','']);
This is where you are adding blank (
''
) strings. First place to check is to make sure this array has the same number of columns as the rest of the table. You also need to make sure this arraybod.push([{text:line[0].text, style:'defaultStyle'}, .... ])
and thedoc.content[1].table.widths = [50 ... ]
array are the proper length.Kevin
Nah Kevin the problem was a bastard ","..
@kthorngren
Hi, Kevin.
I was trying to import the sum of a column in the pdf file but I don't understand why I can't get it I'm enclosing you under the test case link I hope you can help me (I haven't implemented the print function in the file yet because the sum doesn't work for me, I just limited myself to using console.log for debugging)
http://live.datatables.net/toqomaxo/7/edit
The sum function you have is not going to work. Its meant to be used with the Javascript Reduce() method which will sum an array of numbers.
You could push the number you want to sum onto an array then each time you push the endRenderText you can use the reduce function to create the sum that you can include. Similar to how reduce() is used in your
endRender
function.Kevin
Can u do an example on this test case Kevin, pleease ?
http://live.datatables.net/toqomaxo/7/edit
@kthorngren
I try this way but console return me:
The object does not support the property or the 'reduce' method.
The content of "controllo_epal" is:
Here you go:
http://live.datatables.net/toqomaxo/8/edit
Add these code snippets:
Kevin
hi
hy ..can anyone help pdf is not working im row grouping ..
here i attached the code
{ text:'PDF',
extend: 'pdf',
footer : true,
header : true,
orientation:'landscape',
pageSize: 'LEGAL',
page:'current',
customize: function (doc) {
var lastColX=null;
var lastColY=null;
var headerRows = 2;
var dataSrc = 0;
}
],
});
Please Kevin's reply in your other thread,
Colin
ok..i understood print is not working in datatable
but we can do pdf in rowgrouping below is the link which i got from above..
my prblm is it is not working in my table..
http://live.datatables.net/toqomaxo/8/edit
Can you explain what isn't working for you, please. I'm seeing totals in both the table and the PDF.
Colin