Skip to content

Commit

Permalink
Made cell.save consistent with row.save in terms of requiring a callb…
Browse files Browse the repository at this point in the history
…ack. (#105)
  • Loading branch information
tablekat committed May 12, 2016
1 parent 5a52afa commit d1a2dc5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ var SpreadsheetWorksheet = function( spreadsheet, data ){
spreadsheet.addRow(self.id, data, cb);
}
this.bulkUpdateCells = function(cells, cb) {
if ( !cb ) cb = function(){};

var entries = cells.map(function (cell, i) {
cell._needsSave = false;
return "<entry>\n <batch:id>" + cell.batchId + "</batch:id>\n <batch:operation type=\"update\"/>\n <id>" + self['_links']['cells']+'/'+cell.batchId + "</id>\n <link rel=\"edit\" type=\"application/atom+xml\"\n href=\"" + cell._links.edit + "\"/>\n <gs:cell row=\"" + cell.row + "\" col=\"" + cell.col + "\" inputValue=\"" + cell.valueForSave + "\"/>\n </entry>";
Expand All @@ -434,6 +436,7 @@ var SpreadsheetWorksheet = function( spreadsheet, data ){
}

this.setHeaderRow = function(values, cb) {
if ( !cb ) cb = function(){};
if (!values) return cb();
if (values.length > self.colCount){
return cb(new Error('Sheet is not large enough to fit '+values.length+' columns. Resize the sheet first.'));
Expand Down Expand Up @@ -613,6 +616,7 @@ var SpreadsheetCell = function( spreadsheet, worksheet_id, data ){
});

self.save = function(cb) {
if ( !cb ) cb = function(){};
self._needsSave = false;

var edit_id = 'https://spreadsheets.google.com/feeds/cells/key/worksheetId/private/full/R'+self.row+'C'+self.col;
Expand Down Expand Up @@ -658,6 +662,3 @@ var xmlSafeColumnName = function(val){
return String(val).replace(/[\s_]+/g, '')
.toLowerCase();
}



0 comments on commit d1a2dc5

Please sign in to comment.