Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Sheet's title after removing and adding the new one #35

Merged
merged 1 commit into from
Aug 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions jquery.sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,13 @@ $.sheet = {
*/
sheetCount:0,

/**
* The continuous count of sheet's within the instance.
* @memberOf jS
* @type {Number}
*/
sheetContinuousCount: 0,

/**
* The internal storage array of the spreadsheets for an instance, constructed as array 3 levels deep, spreadsheet, rows, cells, can easily be used for custom exporting/saving
* @memberOf jS
Expand Down Expand Up @@ -7207,6 +7214,7 @@ $.sheet = {
jS.setActiveSheet(jS.sheetCount);

jS.sheetCount++;
jS.sheetContinuousCount++;

jS.sheetSyncSize();

Expand Down Expand Up @@ -7450,7 +7458,7 @@ $.sheet = {
sheetTab:function (get, callback) {
var sheetTab = '';
if (get) {
sheetTab = jS.obj.table().attr('title') || jS.msg.sheetTitleDefault.replace(/[{]index[}]/gi, jS.i + 1);
sheetTab = jS.obj.table().attr('title') || jS.msg.sheetTitleDefault.replace(/[{]index[}]/gi, jS.sheetContinuousCount + 1);
if (callback) {
callback(sheetTab);
}
Expand All @@ -7461,7 +7469,7 @@ $.sheet = {
function(newTitle) {
if (!newTitle) { //The user didn't set the new tab name
sheetTab = jS.obj.table().attr('title');
newTitle = (sheetTab ? sheetTab : jS.msg.sheetTitleDefault.replace(/[{]index[}]/gi, jS.i + 1));
newTitle = (sheetTab ? sheetTab : jS.msg.sheetTitleDefault.replace(/[{]index[}]/gi, jS.sheetContinuousCount + 1));
} else {
jS.setDirty(true);
jS.obj.table().attr('title', newTitle);
Expand Down Expand Up @@ -7706,6 +7714,7 @@ $.sheet = {
load: function() {
jS.controlFactory.sheetUI(this.ui, this.table, this.i);
jS.sheetCount++;
jS.sheetContinuousCount++;

stack.push(this.i);

Expand Down