- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Asp.Net KendoUI Grid MVC 帮助程序,但无法使分页正常工作。具体来说,我无法显示总记录。这是代码:
@(Html.Kendo().Grid(Model.FunctionList.AsEnumerable())
.Name("Grid")
.DataSource(dataSource => dataSource
.Server()
.Total(50)
.Model(model => model.Id(f => f.FunctionId))
.Read(read => read.Action("Index", "Function"))
.Update(update => update.Action("Edit", "Function"))
.Destroy(destroy => destroy.Action("Delete", "Function"))
)
.Columns(columns =>
{
columns.Bound(f => f.FunctionName);
columns.Bound(f => f.FunctionDescription);
columns.Command(command => { command.Custom("Edit").Action("Edit", "Function").SendDataKeys(true); command.Destroy(); }).Width(200);
})
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.PageSizes(true)
.ButtonCount(5))
.Filterable(filterable => filterable
.Extra(false)
.Operators(ops => ops
.ForString(str => str.Clear()
.Contains("Contains")
.StartsWith("Starts with")
.EndsWith("Ends with")
.IsEqualTo("Equal to")
.IsNotEqualTo("Not Equal To")
)))
)
注意.Total(50)。无论选择的页面大小(5、10 或 20)如何,我都只得到 1 页,即网格显示“n 项中的 1 到 n”,其中 n 是页面大小。对于页面大小为 5 且总记录为 50 的情况,应显示“1 -5 of 50 items”。
生成的 javascript(查看源代码)显示 Total(50) 没有效果:
"pageSize":5,"page":1,"total":5,"serverPaging":true
注意“total”:5,它应该是“total”:50
最佳答案
我正在发布整个网格,该网格在我的应用程序上运行良好。但我查看了您的代码,您的数据源属性有问题,您缺少 .Ajax() 和 .ServerOperation(false)(我添加这两个后就可以进行分页了),和我的对比一下你就会发现真正的原因
Html.Kendo().Grid(Model.asdry).Name("abc").Columns(c =>
{
c.Bound(p => p.datetimecalculated).Format("{0:dd-MM-yyyy}");
c.Bound("").ClientTemplate("#= purchaseCriteria(data) #").Title("Sold/Bought");
c.Bound(p => p.numcontracts);
c.Bound(p => p.entityid);
c.Bound(p => p.leagueid);
c.Bound("")
.ClientTemplate("#= setSeasonYear(data) #")
.Sortable(false)
.Title("Year");
c.Bound("")
.ClientTemplate("#= setSeason(data) #")
.Sortable(false)
.Title("Season");
c.Bound(p => p.contractmeasurable);
c.Bound(p => p.price).ClientTemplate("#= moneyformat_at(price) #");
c.Bound(p => p.profitorloss).ClientTemplate("#= moneyFormat(profitorloss) #");
}).DataSource(
d => d
.Ajax()
.ServerOperation(false)
)
.Pageable()
.Sortable()
.Resizable(resizing => resizing.Columns(true))
)
更新使用这些的原因如下.Ajax()//指定使用ajax绑定(bind).ServerOperation(false)//分页、排序、过滤和分组将在客户端完成
关于asp.net-mvc - KendoUI MVC 助手网格分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21863893/
有时我需要(为了让我的开发更快)在我的代码中对一些东西进行硬编码。这可能是凭据,或者可能只是一个允许我测试某些功能的 hack。由于很多原因,我从来不想将这段代码推送到主代码库甚至开发分支。一段时间以
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 2 年前。 Improve this qu
我经常发现自己从类中提取常见行为到只包含一组静态方法的帮助程序/实用程序类中。我经常想知道是否应该将这些类声明为抽象类,因为我真的想不出实例化这些类的正当理由? 将这样的类声明为抽象类的优点和缺点是什
如果我这样做: $obj = factory(Object::class)->make(); collect($obj); 我返回了一个类型的集合: Illuminate\Support\Collec
我有一个应用程序,我可以在其中列出 parent 和 child 。当我添加一个 child 时,我需要获得一个 parent 列表作为下拉列表显示。有没有类似 collection_select 的
我有渲染组件( source ),用于从 Controller 字段渲染组件/助手。它适用于 ember 1.9.1,但在更新到 ember 1.12.1 后,我发现 API 发生了变化。之后upda
我刚开始使用 Rails,还有很多东西需要学习,所以我可能会比平常更频繁地在 Stackoverflow 上询问初学者 Rails/Ruby 问题。 我只是想弄清楚 Helpers 在 Rails 中
我在 Web 上使用 VS Express 2012。我的项目是一个 MVC 4 项目。 我正在尝试创建一个助手来创建一个菜单项,该菜单项是带有标签的 png 图像。我几乎剪切并粘贴了这段代码: Ac
我正在尝试在我的 Vue 页面中映射我商店的状态变量: export default { data: () => ({ localData: []
我目前正在开发一个 Rails 插件,用于生成 iPhone 特定的 HTML 元标记。我尝试使用 ActionView::TestCase 进行单元测试,但不断收到相同的错误。请参阅下面的文件内容和
我正在努力解决一个与变量声明相关的非常基本的问题。我已经阅读了有关变量的所有内容,但我不知道我的问题是否与 1) 我如何声明变量或 2) 我如何设置变量的范围有关。 首先,我对 Meteor 中变量的
我想知道是否可以将参数传递给 Meteor Helper 并在 HTML 中插入返回对象的属性,而不仅仅是返回最终值。我有这样的东西: HTML: {{#each conversation}}
我正在尝试为我的 Ember 应用程序构建一个新的条件助手。值得一提的是,我正在使用使用 Handlebars 2.0 的 Ember 1.10.1,并且我无法升级它,如果能很好地解决这个版本的 Em
我最近从 Dreamweaver 迁移到 aptana,并尝试使 aptana 尽可能相似;) 已经做了很多更改,但我仍然找不到使代码字体变小的方法(在 Dreamweaver 中代码更清晰,因为字体
我有以下模板: {{#each helperOne "1" "2" }} Lorem upsom {{#each}} helper : template.tempName.h
我有这个简单的代码块,它位于我的一个模板上,但我想将其作为助手放置,以便我的所有 View 都可以访问它。 @hidden(field: Field) = { @defining(field)
使用正则表达式,我正在替换 **text in bold**至 text in bold在一个字符串中,然后显示 message使用 {{{message}}}在我的 EmberJS 模板上。问题是我
是否有任何非常有用和健壮的 C++ 网络库?和库来帮助他们更好地运行?诸如使用 << 时自动进行字节序转换之类的东西,阻止读取直到结构或 w/e 您的读取完全传输,有助于调试协议(protocol)的
模板 {{#each tags}} {{#isObject this}} Object {{else}}
我有返回 JSON 的函数: Template.mainmenu.menuitem = function() { var jsonObj = { items: [ { ur
我是一名优秀的程序员,十分优秀!