Working example for pagination
Closed this issue · 7 comments
I need an working example for pagination using loveseat.. whereas i am not able to understand clearly in the document and i tried it but ended up with faliure.. Pls help me in doing this.. its urgent..
Thanks in advance.
Just pass in start and skip options.
On Dec 17, 2012 12:01 PM, "Rameshvenkat" notifications@github.com wrote:
I need an working example for pagination using loveseat.. whereas i am not
able to understand clearly in the document and i tried it but ended up with
faliure.. Pls help me in doing this.. its urgent..
Thanks in advance.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/43.
Sorry i tried it out... but could't get it.... just give me a flow of working scenario..
Where CompanyViewModel inherits from PagableModel
[HttpGet]
public ActionResult List(CompanyViewModel model)
{
var options = model.GetOptions();
var etag = Request.Headers["If-None-Match"];
#if DEBUG
etag = "";
#endif
options.Etag = etag;
var result =
Db.View("companies_by_name", options);
if (result.StatusCode == HttpStatusCode.NotModified)
{
Response.StatusCode = 304;
Response.End();
return null;
}
model.UpdatePaging(options, result);
model.Companies = model.Descending ? result.Items.Reverse() :
result.Items;
Response.AddHeader("ETag", result.Etag);
return View(model);
}
On Mon, Dec 17, 2012 at 11:23 PM, Rameshvenkat notifications@github.comwrote:
Sorry i tried it out... but could't get it.... just give me a flow of
working scenario..—
Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-11474367.
Martin Murphy
Whiteboard-IT
http://whiteboard-it.com
w: (205) 588-7102
I am getting error in this line ( var options = model.GetOptions();) that Object reference not set to an instance of an object. at LoveSeat.PagingHelper.GetOptions(IPageableModel model). pls help me to fix this.
model is not set to an instance of an object. Maybe you should step back
and go through some tutorials on C#, like anything else you need to walk
before you run.
If you have questions about LoveSeat I'll be happy to answer them, but I
can't just debug your application for you.
On Tue, Dec 18, 2012 at 7:00 AM, Rameshvenkat notifications@github.comwrote:
I am getting error in this line ( var options = model.GetOptions();) that
Object reference not set to an instance of an object. at
LoveSeat.PagingHelper.GetOptions(IPageableModel model). pls help me to fix
this.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-11484941.
Martin Murphy
Whiteboard-IT
http://whiteboard-it.com
w: (205) 588-7102
Ok. could you say me that what would come in that CompanyViewModel ???
This is how i ve implemented it as u said... where do i go wrong here..
public List Getdocs(IPageableModel model)
{
List resultList = new List();
var etag = "";
var options = new ViewOptions();
options = model.GetOptions();
options.StartKeyDocId = lastId;
options.Limit = 13;
options.Skip = 1;
var result = oCouchDB.View("GetAlldocs", options);
//model.UpdatePaging(options, result);
if (result.StatusCode == HttpStatusCode.NotModified)
{
response.StatusCode = "0";
return null;
}
if (result != null)
{
foreach (newVO newvo in result.Items)
{
resultList.Add(newvo );
}
}
return resultList;
}