Two Table Single Row
See original GitHub issueHow add multiple table in single row. When using startX and endX it doesn’t show any progress rather than they are showing the same as the before.
const doc = new jsPDF("l", "mm", "a4");
// tslint:disable-next-line:no-shadowed-variable
const drawCell = function (data: { doc: any; table: { body: any; }; row: { index: number; }; }) {
// tslint:disable-next-line:no-shadowed-variable
const doc = data.doc;
const rows = data.table.body;
if (data.row.index === rows.length - 1) {
doc.setFontStyle("bold");
// doc.setFontSize(12);
doc.setFillColor(255, 255, 255);
}
};
const data = [];
data.push([ '1', 'shubham', 'dave', 'milan', '13245']);
data.push(['2', 'haresh', ' 11324', '', '132453' ]);
data.push(['3', 'milan', 'vadher', '12345', '']);
data.push(['4', 'axay', '', '' , '']);
data.push(['5']);
doc.autoTable({
startY: curruntHeight,
startX: 10,
endX: 90,
margin: 10,
willDrawCell: drawCell,
head: [['Sr.No', 'Particulars', 'Qty. after inert deduction', 'Price/Kg or Price/Pcs (Rs)', 'Amount (Rs)']],
body: data,
theme: 'grid',
headStyles: { fillColor: [255, 255, 255], textColor: [0, 0, 0], lineWidth: 0.3, lineColor: [0, 0, 0] },
bodyStyles: {
textColor: [0, 0, 0],
lineWidth: 0.3, lineColor: [0, 0, 0]
},
columnStyles: {
0: { columnWidth: 1, halign: 'left' },
1: { columnWidth: 1, halign: 'center'},
2: { columnWidth: 1, halign: 'right' },
3: { columnWidth: 1, halign: 'right' },
4: { columnWidth: 1, halign: 'right' },
},
});
const data1 = [];
data1.push([ '1', 'dashdkjaksd``', 'dave', 'milan', '13245']);
data1.push(['2', 'haresh', ' 11324', '', '132453' ]);
data1.push(['3', 'milan', 'vadher', '12345', '']);
data1.push(['4', 'axay', '', '' , '']);
data1.push(['5']);
doc.autoTable({
startY: curruntHeight + 20,
startX: 160,
endX: 250,
margin: 10,
willDrawCell: drawCell,
head: [['Sr.No', 'Particulars', 'Qty. after inert deduction', 'Price/Kg or Price/Pcs (Rs)', 'Amount (Rs)']],
body: data1,
theme: 'grid',
headStyles: { fillColor: [255, 255, 255], textColor: [0, 0, 0], lineWidth: 0.3, lineColor: [0, 0, 0] },
bodyStyles: {
textColor: [0, 0, 0],
lineWidth: 0.3, lineColor: [0, 0, 0]
},
columnStyles: {
0: { columnWidth: 10, halign: 'left' },
1: { columnWidth: 10, halign: 'center'},
2: { columnWidth: 10, halign: 'right' },
3: { columnWidth: 10, halign: 'right' },
4: { columnWidth: 10, halign: 'right' },
},
});
now how to use the data to show the 2 tab;le in same row
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
HTML how to align two tables in one row? - Stack Overflow
How to align two tables in one row, in the middle of the page? The results that I want to see: 11 12...
Read more >How to put make multiple tables in a single row - TeX
tabular go side by side by default, just put them in the same table but why are you using tabularx here and forcing...
Read more >SQL UNION | Intermediate SQL - Mode Analytics
Put differently, UNION allows you to write two separate SELECT statements, and to have the results of one statement display in the same...
Read more >How To Create Side-by-side Tables - W3Schools
Tip: Go to our CSS Tables Tutorial to learn more about how to style tables. Tip: Go to our CSS Float Tutorial to...
Read more >Split a table - Microsoft Support
The table splits into two tables. The table is split into two tables. You can split the table further, as long as there...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
let me check this @Subtletree 👍
Can’t find any documentation for
startX
andendX
.Instead, add
margin: { left: x }
to the second table and settableWidth
on both tables.There’s an example here that uses left margin on one table and right margin on the other table https://github.com/simonbengtsson/jsPDF-AutoTable/blob/3a2f64f113bafec212e5680aba22f548168b670c/examples/examples.js#L136-L153