HTML5 Data Bindings Support Product Page

In progress

App and PhoneGap... not always the data source is loaded.

Reported 12 Jan 2015 10:28:40
has this problem
12 Jan 2015 10:28:40 Michele - posted:
I'm using your extensions for an App built with jQuery Mobile and packaged with PhoneGap Build.
I've connected a MySQL remote database to view dynamic news lists in the html pages.

I've used these instructions:

It's all ok except abnormal behavior when the page loads. Not always the data source is loaded.
When this happens, the html page is blank (or view only the static content) and is necessary refresh (or re-open the app... even more times).

This is the code used in the page (for the privacy, I've used invented names connection in this code).

In the head:

<script src="ScriptLibrary/jquery-latest.pack.js"></script>
<script type="text/javascript" src="ScriptLibrary/dmxDataBindings.js"></script>
<script type="text/javascript" src="ScriptLibrary/dmxDataSet.js"></script>
<script type="text/javascript" src="ScriptLibrary/dmxDataFilters.js"></script>
  /* dmxDataSet name "connTEST" */
         {"id": "connTEST", "url": "", "data": {"limit": "25"}, "siteName": "NAMEWEBSITE-APPSDB", "dataSourceType": "database", "dataType": "jsonp", "beforeSend": "MM_changeProp('news-ticker-preloader','','display','block','DIV');", "complete": "MM_changeProp('news-ticker-preloader','','display','none','DIV');"}
  /* END dmxDataSet name "connTEST" */
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
    else eval(""+theProp+"='"+theValue+"'");

In the body:
    <div data-binding-show="{{ &quot;connTESTtotal&quot;, &quot;!=&quot;, 0 )}}">
      <div id="news-ticker-preloader"><img src="img/loader_light.gif" alt=""/></div>
      <div class="news-ticker">
          <li data-binding-repeat="{{connTESTdata}}" data-binding-id="repeat1" data-binding-repeat-onafterrender="MM_callJS('$(function(){$(\'.news-ticker\').easyTicker({visible: 1,interval: 10000,direction: \'down\'});});');">{{desc_newsticker}}</li>

Any ideas to resolve this issue?
Now, it's impossible to create an app with dynamic content.



Replied 12 Jan 2015 10:38:09
12 Jan 2015 10:38:09 Teodor Kuduschiev replied:
Hello Michele,
Does this happen when loading the page directly in the phone browser?
Most probably this is an internet connection issue. Try attaching some alerts to the repeat region on the different events so they report which event runs and when exactly it stops.
Replied 12 Jan 2015 11:08:50
12 Jan 2015 11:08:50 Michele - replied:
Hi Teodor,
yes, it's happens even when I'm testing the app (as webapp) in the mobile browser (safari, chrome).
I've this behavior in all situations (wi-fi, 3g, 4g) and more platforms (iOS, Android, Windows Phone).

A question... how can I debug the app to view a "event runs report"?
PhoneGap Build offers some tools?
Replied 12 Jan 2015 11:15:30
12 Jan 2015 11:15:30 Teodor Kuduschiev replied:
Use the behaviors, available for the repeat region:
alert("Alert Text");

for Data/BeforeRender/AfterRender, to see which of them actually run.
Replied 13 Jan 2015 18:43:06
13 Jan 2015 18:43:06 Michele - replied:
I've tested and with an Internet connection mobile limited (gprs or wi-fi unstable) the data source not load.

Do you know if exist a way to save data source in a cache, that load it automatically when mobile connection isn't available (or limited)?

Last thing, could you tell me the difference from "data-binding-repeat-onafterrender" and "data-binding-repeat-ondata"?
I noticed that if I use "data-binding-repeat-ondata" to load the script in the page, the news lists increases the possibility to view them.

<li data-binding-repeat="{{}}" data-binding-id="repeat1" data-binding-repeat-ondata="MM_callJS('$(function(){$(\'.news-ticker\').easyTicker({visible: 1,interval: 10000,direction: \'down\'});});');">{{desc_newsticker}}</li>


Replied 13 Jan 2015 18:47:19
13 Jan 2015 18:47:19 Teodor Kuduschiev replied:
If you call a third party script, that uses data from data-bindings data source, you should call it onafterrender. So the script will actually be able to use the data-bindings data.
There is a huge update that our developers are currently working on for HTML5 Data Bindings and the rest of the database tools so the cache option will be available in the near future.
Replied 13 Jan 2015 19:02:10
13 Jan 2015 19:02:10 Michele - replied:
I hope to see soon this update.

Replied 16 Feb 2015 10:32:10
16 Feb 2015 10:32:10 Michele - replied:
Hello Teodor,
I've big problems about the loading issue with the app.

Do you know if is possible with javascript (ajax), reload every x seconds the script/div used for dmxDataSet (without reload the full page)?
Now, the App sometimes open with the MySQL's records, sometimes not, and is necessary reload all to see them (reopen the app)... when it happens, the page is blank/empty.

Replied 25 Feb 2015 16:32:49
25 Feb 2015 16:32:49 Michele - replied:
Hello... is available with the last version 1.7.1 (lunched today, 25 February), the cache option?
Replied 25 Feb 2015 16:34:05
25 Feb 2015 16:34:05 Teodor Kuduschiev replied:
Unfortunately this is not yet added, as it is still under development. You can check what's new here:
Replied 25 Feb 2015 16:35:39
25 Feb 2015 16:35:39 Michele - replied:
Ok, thanks.

Reply to this topic