CouchApp Problem Documents

I have problems because I cannot find resources and / or tutorials that give me enough knowledge on how to do this correctly:

I am creating a Couchapp up contacts database. To do this, I need to have an unordered list of contacts (only names) on the landing page. Having considered this for quite some time now and studying the structure of http://kansojs.org , I think I might have to ask here at Stackoverflow how to do it right ...

Here is what I ended up (not working):

I started to customize the view (file "views / contactslist / map.js):

function(doc) {
  if (doc.displayName) {
    emit(doc.displayName, {displayname: doc.displayName});
  }
};

... which basically returns me the answer:

{"total_rows":606,"offset":0,"rows":[
{{"id":"478d86edbbd94bbe627f3ebda309db7c","key":"Al Yankovic","value":{"displayname":"Al Yankovic"}},
{"id":"478d86edbbd94bbe627f3ebda30bb5cb","key":"Al-Qaeda","value":{"displayname":"Al-Qaeda"}}
]}

, "" "mustache.html", "data.js" "query.json":

mustache.html:

<ul>
  {{#contacts}}
    <li>
        <div class="name">
          {{displayname}}
        </div>
      <div style="clear:left;"></div>
    </li>
  {{/contacts}}
</ul>

data.js:

function(data) {
  $.log(data)
  var p;
  return {contacts : data.rows};
};

query.json:

{
  "view" : "contactslist",
  "descending" : "true"
}

     $ ( "# " ). evently ( "", ); index.html _attachments.

Firebug / CouchDB, vie, , . ?

+5
2

data.js, query.json mustache.html //_init/

_init , .

+2

Looking through this tutorial has helped a lot.

+1
source

All Articles