jsPDF-AutoTable icon indicating copy to clipboard operation
jsPDF-AutoTable copied to clipboard

Cannot get row above tableheader

Open akshaybhoendie opened this issue 9 years ago • 1 comments

Hi friend, Sorry for asking so many questions, but i looked at your example and i wanted to add a row above the the tabel header, for some reason it stays under the table header . Please look at the row with text " rapportage handelsregister"Here is a picture of how it comes with code and here is my code : `doc.autoTable(columns, rows, { theme : 'grid', styles: { halign: 'right' }, headerStyles: { fillColor: [33, 150, 243], halign:'center' }, margin : { top : 100 }, columnStyles:{ 0: {halign:'left'} }, createdCell: function(cell, data) { if (data.row.index === 0 || data.row.index === 3 ||data.row.index === 6 ||data.row.index === 9 || data.row.index === 12 || data.row.index === 13 || data.row.index === 14) {

		        				      cell.styles.fontStyle = 'bold';
		        				      cell.styles.fillColor = [255,251,204];
		        				    }
		        			},
		        			 drawRow: function (row, data) {
		        		            // Colspan
		        		            doc.setFontStyle('bold');
		        		            doc.setFontSize(20);
		        		            if (row.index === 0) {
		        		                doc.setTextColor(200, 0, 0);
		        		                doc.rect(data.settings.margin.left, row.y, data.table.width, 20, 'S');
		        		                doc.autoTableText("Raportage Handelsregister", data.settings.margin.left + data.table.width / 2, row.y + row.height / 2, {
		        		                    halign: 'center',
		        		                    valign: 'middle',
		        		                    
		        		                });
		        		                data.cursor.y += 20;
		        		            } 
		        			 }
	        			});`

akshaybhoendie avatar Jan 20 '17 16:01 akshaybhoendie

No worries, keep them coming! Closing this since it is a crosspost of http://stackoverflow.com/questions/41749622/cant-put-row-above-tableheader. Will take a look at it when I got the time. Btw this will probably be easier to accomplish with colspans and multiple headers which are both supported in the upcoming version 3 that will be released in a few days.

simonbengtsson avatar Jan 20 '17 16:01 simonbengtsson