Forums: Preserving Tab State after Save - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Preserving Tab State after Save

#1 User is offline   MK Frank R 

  • Member
  • PipPip
  • Group: Members
  • Posts: 14
  • Joined: 24-May 11

Posted 08 August 2017 - 05:31 PM

Greetings,

I am using ASPRunner.NET Enterprise V9.8. [The best RAD tool on the planet.]

We are building an app using the Bootstrap layout. We have an Edit page separated into sections with various Tabs. Turns out that if you are on, say, the third tab and click Save, it resets to the first tab. Here is a snippet to preserve Tab state across the Saves:


In List page Javascript onload:
//---------------------------------------------------------------------
// From List page, establish that we would start at first Tab
//---------------------------------------------------------------------
localStorage.setItem('CurrentTab', 0);   



In Edit page Javascript onload:
//---------------------------------------------------------------------
// Before Save, this event fires to store what Tab user is actually on
//---------------------------------------------------------------------
this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){         
        localStorage.setItem('CurrentTab', pageObj.getTabs().activeIdx());  
});

//---------------------------------------------------------------------
// Set Tab based on what we have stored as Current Tab
//---------------------------------------------------------------------
pageObj.getTabs().activate(localStorage.getItem('CurrentTab'));  

0

#2 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 311
  • Joined: 26-April 08

Posted 09 August 2017 - 01:41 AM

That is awesome. Thanks for sharing. And yes - best rad tool ever!
-jerry
0

#3 User is offline   MK Frank R 

  • Member
  • PipPip
  • Group: Members
  • Posts: 14
  • Joined: 24-May 11

Posted 09 August 2017 - 08:04 PM

Sergey and I tag teamed on that one. :)

Thank God there was a way. I really needed to preserve the current tab after a Save.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic