framework7 icon indicating copy to clipboard operation
framework7 copied to clipboard

Template7 Data Context lost after page back

Open Donnylai opened this issue 10 years ago • 9 comments

Hi, I got the first page load as follows:

var frontpage = {todayStr: todayStr, todayRoster: todayRoster, chnName:roster.chnName, ...}; mainView.router.load({ url: 'app/today.html', reload: true, context: { frontpage: frontpage } }); Then, a page (leave) was invoked as follows: var showLeave = function () { mainView.router.load({ url: 'app/leave.html', context: { } }); } When page back, if is OK. However, if another page (leaveform) was invoke in the leave page as follows: var showSickLeave = function () { mainView.router.load({ url: 'app/leaveform.html', context: { sickleave: true, todaystr: todaystr } }); } Then, When page back, I got the follow error Unhandled exception at line 30, column 803 in eval code 0x800a138f - JavaScript runtime error: Unable to get property 'chnName' of undefined or null reference

** Where chnName is a context data used in the the today page instead of the leave page. ** I suppose the page back from the leaveform page will go back to the leave page. I don't know why the 'today' page was evaluated and the data-context is null.

Donnylai avatar Mar 31 '16 09:03 Donnylai

Would be good how to replicate it more detailed, even better live example

nolimits4web avatar Apr 29 '16 17:04 nolimits4web

I have the same issue. You can see it if you make more than 3 backs. Here is data when context is lost context.json.zip

AriadnaA avatar Jul 05 '16 10:07 AriadnaA

I found that, in Framework7, Template7 cannot been applied more than 1 layer. Otherwise, the data in higher layers will be lost.

Donnylai avatar Jul 05 '16 10:07 Donnylai

Context data isn't lost in history, it just wasn't shown in current page context. I hope It could be fixed easily.

AriadnaA avatar Jul 05 '16 10:07 AriadnaA

Yes, this is a great issue ! Vladimir, you have any fix ?

smtrad avatar Aug 16 '16 20:08 smtrad

I gave up to rely on template7 on the higher level pages. I used onpageinit callbacks to assign values to the higher level pages with javascript.

Donnylai avatar Aug 16 '16 21:08 Donnylai

I'm using F7 with AngularJS. I tried to solve with page callbacks but without success (Page recompile isn't alternative in my project). I'm waiting Vladimir position about this.

smtrad avatar Aug 17 '16 12:08 smtrad

Any update for this problem? I have the same and it's really blocking me :(

djsliders avatar Aug 31 '16 14:08 djsliders

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 25 '18 13:06 lock[bot]