couchdb - Problem listing documents in a CouchApp -
i in bit of trouble not able find resources and/or tutorials give me enough knowledge how properly:
i building couchapp uppon contact database. need have unordered list of contacts(only names) on landing page. after examining quite time , examining http://kansojs.org framework, think might have ask here @ stackoverflow how done properly...
here ended (not working):
i started setup view (file 'views/contactslist/map.js ):
function(doc) { if (doc.displayname) { emit(doc.displayname, {displayname: doc.displayname}); } };
... gives me response:
{"total_rows":606,"offset":0,"rows":[ {{"id":"478d86edbbd94bbe627f3ebda309db7c","key":"al yankovic","value":{"displayname":"al yankovic"}}, {"id":"478d86edbbd94bbe627f3ebda30bb5cb","key":"al-qaeda","value":{"displayname":"al-qaeda"}} ]}
afterwards, created new directory in evently directory, 'contacts' , created files "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" }
then added , $("#contacts").evently("contacts", app); index.html in _attachments directory.
watching console in firebug can not see request/response couchdb returning vie's results, think not requested. did take wrong turn?
data.js, query.json , mustache.html need in evently/contacts/_init/
_init means gets executed on widget initialization.
Comments
Post a Comment