javascript - jquery "listview" and charts -
i have troubles display charts (jquery charts) web.
i have 2 pages (1.html , 2.html). first contain listview links second page. 2.html displays chart. here problem: when page 2 launched through page 1, chart doesn't appear!! if reload page 2.. chart appears!
if work page using "href=#page" references chart works fine , it's displayed, intention have different html files, 1 of them listview , other 1 chart. possible?
i have tested many types of jquery charts , of them had same behavior.
any idea?
thanks all, best regards.
here files:
1.html ----
<head> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> </head> <body> <div data-demo-html="true"> <ul data-role="listview" data-inset="true"> <li><a href="2.html">chart</a></li> </ul> </div> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js">/script> </body>
2.html code reference (jqwidgets - chart_bar)
to understand situation need understand how jquery mobile works. uses ajax load other pages.
first page loaded normally. head , body loaded dom, , there await other content. when second page loaded, body content loaded dom.
the realistic solution move of javascript original first html. collect , put inside single js file, head. initialize after jquery mobile has been loaded. use same index.js file , initialize inside head of every possible other page.
now can ask me why?
phonegap jquery mobile buggy, , sooner or later there's going error , app fail (including loaded dom) if every js content inside single html file. dom erased , phonegap refresh current page. if page don't have javascript not work until restarted.
i've listed other ways fix problem (with examples) in answer here: why have put script index.html in jquery mobile.
Comments
Post a Comment