question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mixing inline and ajax pages

See original GitHub issue

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Framework7 Version: 1.5.2

  • Platform and Target: Phonegap Desktop, Browser

What you did

I have a single view with one inline page inside and a couple of ajax pages. To activate the hash navigation I set: domCache: true

Expected Behavior

I expected that the ajax pages wouldn’t be loaded any more as soon as they are cached AND the cached page will be shown. Mixing Ajax and inline pages should be possible.

Actual Behavior

The cashed page remains in DOM and the ajax page is also loaded. The bad thing about it is that it results in duplication of id’s - the code picks the cached page (which is the first in dom) but the fresh loaded page is the one being displayed.

The DOM after first ajax-questions-page loading:

<div class="views">
    <!-- view -->
    <div class="view view-main" data-page="questions">
        <div class="navbar">...</div>
        <!-- Pages container -->
        <div class="pages navbar-fixed toolbar-fixed">
            <!-- questions is the ajax page questions.html -->
            <div data-page="questions" class="page page-on-left">...</div>
            <!-- this is my inline page -->
            <div data-page="index" class="page page-on-left">...</div>
        </div>
        <!-- /pages -->
    </div>
    <!-- /view -->
</div>

The DOM after second ajax-questions-page loading:

<div class="views">
    <!-- view -->
    <div class="view view-main" data-page="questions">
        <div class="navbar">...</div>
        <!-- Pages container -->
        <div class="pages navbar-fixed toolbar-fixed">
            <!-- questions is the ajax page questions.html -->
            <div data-page="questions" class="page page-on-left cached">...</div>
            <!-- this is my inline page -->
            <div data-page="index" class="page page-on-left">...</div>
            <!-- this shouldn't be happening -->
            <div data-page="questions" class="page page-on-center">...</div>
        </div>
        <!-- /pages -->
    </div>
    <!-- /view -->
</div>

So what’s happening is the duplication of the ajax loaded page after the second loading. The cached version isn’t being used or being displayed. Mixing inline- with ajax pages isn’t obviously working. But it would be great if it would.

Best, Adrian Maleska

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Danzondocommented, Jan 25, 2017

I have the same problem

1reaction
Danmorengcommented, Sep 15, 2017

I have the same issue: using some inline pages and most pages over ajax. Cache set to be false, domCache set to be true.

Ajax pages are in domCache and therfor I have problems because I use html ids in the ajax pages…

My workaround:

onPageInit:

$$('.cached').each(function(){
    var pageName = $$(this).data('page');
    if(pageName === page.name){
         $$(this).remove();
    }
});

This removes the cached ajax page from the dom, right before I insert the newly loaded one and my scripts which need the unique ids runs. It’s not very elegant, but it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is loading inline JavaScript inside views with AJAX bad?
It isn't really "bad" as long as it serves a purpose (for example, it loads content from other websites like the WordPress dashboard), ......
Read more >
jQuery and Ajax Tutorial
1.xx.x.css from https://qunitjs.com/ and place them in appropriate folders. Link the js and css in your document. Alternatively, you can link to one...
Read more >
Using JavaScript with Ajax and Razor partial views - Pluralsight
This guide shows how to effectively implement JavaScript functionality when creating a web page from Razor partial views, including elements ...
Read more >
jsGrid Inline Table Insert Update Delete using PHP Ajax
Facebook Style Infinite Scroll Pagination in Codeigniter using Ajax · Mix - Webslesson · सर्दियों के लिए स्वाद और सेहत ...
Read more >
Inline Editing using Vanilla JavaScript with PHP MySQL ...
Learn How to Inline Edit MySQL Data using Vanilla JavaScript with PHP and Bootstrap 5 Library. In this video tutorial, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found