c# - Best way to show Total Rows Grid.MVC List -
i have grid.mvc based list allows me create sortable, filterable, paged list.
problem is, can't seem find in documentation grid.mvc in particular ouput "count" of has been filtered. figured may need client side solution through potentially jquery code, hoping maybe there easier.
@using gridmvc.html @model ienumerable<sample.cases> @{ viewbag.title = "case browse list"; } <h2>case browse list</h2> <p> @html.actionlink("add new participant", "create") </p> <div> @html.grid(model).columns(columns => { columns.add().encoded(false).sanitized(false).setwidth(30).rendervalueas(model => @<b>@html.actionlink("select", "details", new { id = model.id })</b>); columns.add(model => model.id).titled("id"); columns.add(model => model.firstname).titled("first name"); columns.add(model => model.middlename).titled("middle name"); columns.add(model => model.lastname).titled("lastname"); columns.add(model => model.lkpsuffixes.suffixdescription).titled("suffix"); columns.add(model => model.lkpcasestatuses.casestatusdescription).titled("case status"); columns.add(model => model.casestatusdate).titled("case status date"); }).withpaging(10).sortable(true).filterable(true).withmultiplefilters() </div>
above view, it's quite simple, need footer below grid states how many results have in total. filterable , paginated, should count of records, not 10 displayed (.withpaging(10)) or total without filtering in columns.
grid.mvc has sample project here: http://gridmvc.azurewebsites.net/?grid-page=3
edit - ideally, footer might "showing 1 10 of 57 entries", or if that's not possible, total entries fine our requirements.
reading of code in github - appears there attributes count of displayed or total rows (after filtering), feel there must built-in way this, not sure how.
https://github.com/leniel/grid.mvc/blob/master/gridmvc/igrid.cs
there's option .withgriditemscount(string griditemsname)
allows display total count.
so can set -
.withpaging(15).withgriditemscount("total orders")
here's output -
Comments
Post a Comment