Home >Web Front-end >JS Tutorial >Two methods for JqueryMobile to dynamically generate listView and implement refresh_jquery

Two methods for JqueryMobile to dynamically generate listView and implement refresh_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:56:591311browse

Two methods for JqueryMobile to dynamically generate listView and implement refresh

Copy code The code is as follows:

function queryEntfernungen(tx, results)
alert("This Hello works");
var len = results.rows.length;
// This For works fine

for (var i = 0; i < len; i ) {
$("div[data-role=content] ul").append('

  • ' results.rows.item(i).name '
  • ');
    }
    $("div [data-role=content] ul").listview('refresh'); // This also works


    But the following method can also succeed!
    Copy code The code is as follows:

    function query(tx, results) {

    var len = results.rows.length, i, j;

    for (i = 0; i < len; i ) {
    $("div[data-role=content] ul").append('

  • ' results.rows.item(i).name '< ;/li>');
    }
    // No listview("refresh") !!

    for (j = 0; j < len; j ) {
    $("#selectmenu").append('');
    }
    $("#selectmenu").selectmenu('refresh', true);

    }

  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn