question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Two Table Single Row

See original GitHub issue

How 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:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shubhamyugtia001commented, Jun 11, 2019

let me check this @Subtletree 👍

1reaction
Subtletreecommented, Jun 11, 2019

Can’t find any documentation for startX and endX.

Instead, add margin: { left: x } to the second table and set tableWidth 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found