Javascript 如何使用剑道设置/更新数据属性?
我希望用CellAction更新“数据\公司\ id”。但是我没有零钱。数据\u公司\u id始终保持“测试”值。我哪里出错了Javascript 如何使用剑道设置/更新数据属性?,javascript,html,kendo-asp.net-mvc,Javascript,Html,Kendo Asp.net Mvc,我希望用CellAction更新“数据\公司\ id”。但是我没有零钱。数据\u公司\u id始终保持“测试”值。我哪里出错了 @(Html.Kendo().DefaultOverviewGrid<SmartFacqt.Web.Models.ComponentViewModel>() .Name("Grid") .Columns(columns => {
@(Html.Kendo().DefaultOverviewGrid<SmartFacqt.Web.Models.ComponentViewModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Code).HtmlAttributes(new { data_company_id = "test" });
})
.CellAction(cell =>
{
cell.HtmlAttributes["data_company_id"] = "hhhhhhhhhhh";
})
.Events(events => events.DataBound("disableButtons"))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Components_Read", "Component"))
.Model(model => model.Id(p => p.Id))
)
)
@(Html.Kendo().DefaultOverviewGrid()
.名称(“网格”)
.列(列=>
{
columns.Bound(p=>p.Code).HtmlAttributes(新的{data\u company\u id=“test”});
})
.CellAction(cell=>
{
cell.HtmlAttributes[“数据公司id”]=“hhhhhhhhhh”;
})
.Events(Events=>Events.DataBound(“disableButtons”))
.DataSource(DataSource=>DataSource
.Ajax()
.Read(Read=>Read.Action(“Components\u Read”,“Component”))
.Model(Model=>Model.Id(p=>p.Id))
)
)
您是说它正在将值设置为“hhhh…”还是不是那样?不是那样。我想要那个,我想要将值设置为'hhhh…'。在我的HTML中,所有值都是“test”。而不是data\u company\u id
trydata company id
;我不认为下划线是有效的。不起作用。我之所以使用下划线是因为:。但即使没有下划线也无法工作。您发布的链接似乎假定网格是服务器绑定的,而不是ajax绑定的。CellAction似乎不适用于Ajax绑定。