Date Sun 15 May 2011 Tags web

As I mentioned in my previous postI was using this tutorial as a basic for CRUD application for couchdb.

But I found that listing of "albums" is very slow. I modified code using for loop examples from the book "High Performance Javascript" and results of the JS tests from gaperton livejournal.

A lot of words for three line change:

function refreshAlbums()      {*          $("#albums").empty();         $db.view("albums/albums",{            success: function( data ) {                      var listItem;                    var header;                    var albumLink;                    data.rows.reverse();           for ( var i=data.rows.length;i--;)                    {                album = data.rows[i].value;                artist = album.artist;                title = album.title;                description = album.description;                listItem =listItem+  "" +                            "" + artist + "<\/h2>" +                            "" + title + "<\/p>" +                            "" + description + "<\/p>";                                            }             $("#albums").html( listItem );                     $("#albums").listview( "refresh" );                    $.fixedToolbars.show();                }            });      }      $(document).ready( handleDocumentReady );

Also, if you update jquery.mobile to jquery.mobile-1.0a4.1, path in scripts in template/partials should look like:

.. raw:: html
</p>

Comments

comments powered by Disqus