columns: [
{ field: "Category", title: "Category", width: "180px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
],
... where" categoryDropDownEditor"是一个客户端功能,可以解决这个问题。
在MVC版本中,似乎没有任何类型。在那儿?我一直相信它应该。每次我需要装饰输入字段时,我都不需要从服务器遍历部分HTML。这似乎是" EditorTemplate"是MVC唯一可用的。
答案 0 :(得分:1)
行。万一有人会遇到同样的问题。我结束了这个"太优雅"解决方案:
.Events(e => e.Edit("editing"))
网格初始化例程(服务器端)中的这一行调用命名的动态方法(客户端):
function editing(e) {
var input = e.container.find("input[name=Regex]");
var textbox = $(document.createElement('textarea')).attr({
id: input.id,
}).width(input.width()).height(input.height()).val(input.val());
input.hide();
textbox.insertAfter(input);
textbox.focus(function () {
/*to make this flexible, I'm storing the current width & height in an attribute*/
$(this).attr('data-defaultwidth', $(this).width());
$(this).attr('data-defaultheight', $(this).height());
$(this).animate({
width: 400
}, 'slow');
$(this).animate({
height: 300
}, 'slow');
}).blur(function () {
/* lookup the original width */
var w = $(this).attr('data-defaultwidth');
var h = $(this).attr('data-defaultheight');
$(this).animate({
width: w
}, 'slow');
$(this).animate({
height: h
}, 'slow');
input.val(textbox.val());
input.trigger('change');
});
}

结束tada,虽然它是一个纯粹的黑客。