Skip to content

Commit 83847f5

Browse files
committed
[DASH-60] Modifications to jsPDF
Fixed residual bug
1 parent ba178c4 commit 83847f5

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

jspdf.plugin.cell.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@
202202
/**
203203
* Create a table from a set of data.
204204
* @param {Object[]} dataSet As array of objects containing key-value pairs
205-
* @param {Array} [headers] Omit or null to auto-generate headers at a performance cost
205+
* @param {String[]} [headers] Omit or null to auto-generate headers at a performance cost
206206
* @param {Object} [config.printHeaders] True to print column headers at the top of every page
207207
* @param {Object} [config.autoSize] True to dynamically set the column widths to match the widest cell value
208208
* @param {Object} [config.autoStretch] True to force the table to fit the width of the page
209209
*/
210-
jsPDFAPI.table = function(dataSet, headers, config){
210+
jsPDFAPI.table = function(data, headers, config){
211211

212212
var models;
213213

@@ -223,21 +223,14 @@
223223
autoStretch = config.autoStretch || true;
224224
}
225225

226-
if(!dataSet){
226+
if(!data){
227227
throw 'No data for PDF table';
228228
}
229229

230-
if(dataSet.isStore){
231-
var isStore = true;
232-
models = dataSet.data.items;
233-
} else {
234-
models = dataSet;
235-
}
236-
237230
// Set headers
238231
if(headers === undefined || (headers === null)){
239232
// No headers defined so we derive from data
240-
headers = this.getKeys(models[0]);
233+
headers = this.getKeys(data[0]);
241234
}
242235

243236
if(config.autoSize){
@@ -250,7 +243,7 @@
250243

251244
for (var i = 0, ln = headers.length; i < ln; i++) {
252245
index = headers[i];
253-
columnMatrix[index] = models.map(function(rec){
246+
columnMatrix[index] = data.map(function(rec){
254247
return rec[index];
255248
});
256249

@@ -293,8 +286,8 @@
293286
// Construct the data rows
294287
var model;
295288

296-
for (var i = 0, ln = models.length; i < ln; i++) {
297-
model = models[i];
289+
for (var i = 0, ln = data.length; i < ln; i++) {
290+
model = data[i];
298291

299292
for (var j = 0, jln = headers.length; j < jln; j++) {
300293
index = headers[j];

0 commit comments

Comments
 (0)