This JQuery plugin lets you map a CouchDb view to a html grid. That’s it. I looked at the other JQuery grid plug-ins – many of which a really great – But I couldn’t get them working and since I’m lazy I wrote this specialized plug-in.
So here are its features:
Before I embark in trying to explain how to use this plug-in, I’m going to explain the JSON data structure that it expects by default. As an example I will use a real database of more than 40K electric power usages records. Here is one of its documents:
We will start by using this simple couchdb view
So if you use the above view by requesting this url [http://22.214.171.124:8080/mydb/design/tests/view/id?limit=2] you will get
Include jquery in your HTML header. You can use googleapis for this or the one that comes with couchdb. Then add jquery.couch-view.js.HTML table with one row of dummy data
Apply the plug-in to a class that you will use for your test grid. In these examples I will use
grid-test. For options I’ve set the URL to our database’s view design document, the view and a page size of 4 lines.
Enliven your Table
grid-test, give it also an
<table id="table-1" bgcolor="gray" class="grid-test" >