是否可以仅启用在Kendo网格中插入新记录,但禁用编辑记录?
我能做的最好的是onDataBound删除JavaScript中的"编辑"按钮.我尝试过设置,Editable(ed => ed.Enabled(false))但在运行时遇到错误.
@(Html.Kendo().Grid(Model)
.Name("Grid" + guid)
.HtmlAttributes(new { style = "margin:20px" })
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden(true);
//a few more columns
columns.Command(command =>
{
command.Edit().Text(Resources.KendoEdit).UpdateText(Resources.KendoUpdateText).CancelText(Resources.KendoCancelText);
command.Destroy().Text(Resources.KendoDestroy);
}).Title(Resources.KendoCommands).Width(180);
})
.ToolBar(toolbar => toolbar.Create().Text(Resources.KendoToolbarCreate))
.Editable(editable => editable
//.Enabled(false)
.Mode(GridEditMode.InLine)
.DisplayDeleteConfirmation(false)
)
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Events(events => events.Sync("sync").Error("error"))
.Model(mod => mod
.Id(p => p.Id)
)
.Model(mod => mod
.Field(p => p.OldRoleId).Editable(false)
)
.Read(read => read.Action("ChangeRole_Read", "ChangeRole"))
.Create(update => update.Action("ChangeRole_Create", "ChangeRole"))
.Update(update => update.Action("ChangeRole_Update", "ChangeRole"))
.Destroy(update => update.Action("ChangeRole_Destroy", …Run Code Online (Sandbox Code Playgroud) KendoUI Grid中的多选似乎相当不错,但它似乎不支持行标题或排除范围.
例如,我希望无法选择下面显示的突出显示的单元格(例如,我想将它们转换为行标题):

回答JQuery/Javascript或服务器端C#Razor语法首选.
根据下面的lgorrious'建议,我将此添加到KendoGrid选项:
dataBound: function() {
$('#grid tr td:first-child').addClass('k-group-cell');
},
Run Code Online (Sandbox Code Playgroud)
通过欺骗网格忽略第一列(认为它是分层网格中的分组级单元格)来实现这一目的.
我无法按原样使用答案,因为我正在使用dataSource作为列,因为它们动态变化,但它让我直接找到一个简单的解决方案
我有需要,比如我需要找到父网格行复选框,如果检查父网格行复选框,那么我需要将所有子网格复选框设置为为该父网格行复选框为真,我已经这样做了... .
<script type="text/javascript">
$(document).ready(function () {
$('#btnMove').click(function () {
var parentgrid = $('#GridParent').data('kendoGrid');
var childGrid = $('#GridParent').closest(".k-grid").data("kendoGrid");
var Count = $('#Gridparent').data("kendoGrid").dataSource.total();
alert(Count);
for (i = 0; i < Count; i++)
{
var isChecked = parentgrid.tbody.find('tr:eq(' + i + ')').find('td').find('.chkbxq').is(':checked');
alert(isChecked); // here i need to get the property of parent grid row checkbox and I am not getting this alert....
if (isChecked == true)
{
var allchildgridchkboxes = childGrid.tbody.find('td').find('chkbx');
alert(allchildgridchkboxes); // i am not getting this alert
// here …Run Code Online (Sandbox Code Playgroud) 在我的Kendo Grid上,我从服务器接收了日期时间.在客户端,此时间将更改为客户端的时区并显示.如何从服务器向客户端显示相同的时间.
以下是我绑定日期时间的kendo代码.
columns.Bound(p => p.CreateDate).Format("{0:dd/MM/yyyy hh:mm:ss}").Sortable(true).Width(180);
Run Code Online (Sandbox Code Playgroud) 我有一个Kendo UI Grid,如下所示.有记录时出现水平滚动条.但是当没有记录时它就不会出现.即使没有记录,如何使用滚动条.
格
<div class="GridSearch">
@(Html.Kendo().Grid<Topco.TopMapp.MVC.Models.TransactionHistoryModel>()
.Name("TransactionHistroyGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.UserId);
model.Field(p => p.Comment).Editable(true);
})
.PageSize(25)
.ServerOperation(true)
.Read(read => read
.Action("TransactionHistorySearch_Read", "Home")
.Data("additionalData")
)
)
.Columns(columns =>
{
columns.Command(c => c.Custom("Edit").Click("editDetails")).HeaderTemplate("Action").HeaderHtmlAttributes(new { style = "text-align: center;" }).Width(90);
columns.Command(c => { c.Custom("Save").Click("saveDetails"); c.Custom("Cancel").Click("cancelDetails"); }).Hidden();
columns.Bound(p => p.UserId).Filterable(false).Title("UserID").HeaderHtmlAttributes(new { style = "text-align: center;" }).Width(90);
columns.Bound(p => p.Status).Filterable(false).Title("Status").HeaderHtmlAttributes(new { style = "text-align: center;" }).Width(70);
columns.Bound(p => p.Reviewed).HeaderHtmlAttributes(new { style = "text-align: center;" }).Template(@<text></text>).ClientTemplate("<input id='checkbox' class='chkbx' type='checkbox' …Run Code Online (Sandbox Code Playgroud) 我需要在Angular-Kendo网格中实现服务器端分页.我无法从Angular方面清楚地了解如何做到这一点.
有人可以帮忙吗?
我已经设置了一个基本的Kendo Grid,我正在使用服务器端的PHP Wrapper库中的DataSourceResult类.
我遇到了一个奇怪的问题...如果我create是一个新记录然后编辑它(没有刷新页面),create则再次调用该操作,而不是update操作.
如果在添加新记录后刷新页面,则update在更改记录后将正确调用该操作.
我可以确认DataSourceResult类在create操作后返回正确的数据,包括id新记录.
任何想法为什么会发生这种情况(以及如何阻止它)?谢谢
更新:这是数据源代码.网址中的查询字符串只是为了轻松区分Chrome控制台中的请求.每个请求传递的附加数据用于ajax.php区分请求的不同操作.
data = new kendo.data.DataSource({
transport: {
create: {
url: '/ajax.php?r=gridCreate',
dataType: 'json',
type: 'post',
data: { request: 'grid', type: 'create' }
},
read: {
url: '/ajax.php?request=gridRead',
dataType: 'json',
type: 'post',
data: { request: 'grid', type: 'read' }
},
update: {
url: '/ajax.php?r=gridUpdate',
dataType: 'json',
type: 'post',
data: { request: 'grid', type: 'update' }
},
destroy: {
url: '/ajax.php?r=gridDestroy', …Run Code Online (Sandbox Code Playgroud) 我正在使用kendo网格,并希望在服务器中执行过滤,排序和分页.我明白我应该添加到dataSource:
serverPaging: true,
serverSorting: true
Run Code Online (Sandbox Code Playgroud)
但是我如何告诉grid/dataSource它应该用于哪个url进行sortig,过滤等等.如果我想自己执行sortig怎么办?我想使用控制kendo提供但是自己去服务器.有没有像"sortTriggered"这样的事件,我可以称之为"prevntDefault"或类似的东西......我不知道.
我试图通过addRow()方法向网格插入一个新行,但我希望它在网格上当前选定的行之后或当前选定的行之前添加?有人可以帮忙吗?目前,我得到的是:
Grid.addRow();
$(".k-grid-edit-row").appendTo("#Grid tbody");
但是这会在表格的底部插入一行.我需要它在特定位置添加行,网格已经有行.
虽然我已经尝试了几次,但我无法解决尝试多种方法.不久,这就是我想要做的事情:只将修改或新行作为对象或JSON字符串.
kendo-grid ×10
kendo-ui ×8
asp.net-mvc ×3
javascript ×2
jquery ×2
angularjs ×1
datetime ×1
telerik ×1