-1
我制作了html模板,并且在弹出式编辑器中使用了该模板。如果我在网格中至少有一条记录,那么它将完美,但如果网格中没有数据,那么if点击添加按钮,然后自定义弹出编辑器将不会打开。没有错误,但弹出编辑器不打开。所以任何人都知道这个问题的解决方案?在此先感谢。 编辑 这是我用过的模板。当网格为空时,自定义弹出式编辑器无法打开
<script id="teamEditorTemplate" type="text/x-kendo-template">
<form method="POST">
<table>
<tr>
<td><div >
Area Prefix:
</div></td>
<td><div>
<input name="area_prefix" class="k-input k-textbox" style="text-align: left" id="area_prefix" required validationMessage="Please Enter Area Prefix"/>
</div></td>
</tr>
<tr>
<td><div >
Area Name:
</div></td>
<td><div>
<input name="area_name" class="k-input k-textbox" style="text-align: left" id="area_name" required validationMessage="Please Enter Area Name"/>
</div></td>
</tr>
<tr>
<td><div >
Source:
</div></td>
<td><div>
<input name="source" style="text-align: left" id="source" required validationMessage="Please Select Source"/>
</div></td>
</tr>
<tr>
<td><div >
Country Name:
</div></td>
<td><div>
<input name="vox_country_id" style="text-align: left" id="vox_country_id" required validationMessage="Please Select Country"/>
</div></td>
</tr>
</table>
</form>
</script>
剑道UI代码是在这里
$("#grid").kendoGrid({
dataSource: dataSource,
pageSize: 10,
serverPaging: true,
serverSorting: true,
sortable:true,
pageable: {
refresh: true,
pageSizes:[10,20,50,100]
},
height: 400,
toolbar: [{ name: "create", text: "Add New Area" }],
columns: [
{ field:"area_prefix", title: "Area Prefix",width:70 },
{ field: "area_name", title:"Area Name",width:90},
{ field: "source", title:"Source",width:70, template: '#= getsourceName(source) #'},
{ field: "vox_country_id", width:70,template: '#= getCountryName(vox_country_id) #'},
{ command: ["edit", "destroy"], title: "Action",width:53}],
editable: {
mode: "popup",
template: $("#teamEditorTemplate").html(),
update: true,
add:true,
destroy: true,
confirmation: "Are you sure you want to remove ?"
},
edit: function(e) {
if(!e.model.id){
$(e.container).parent().find('.k-window-title').html("Add Area Details");
$(e.container).parent().find('.k-grid-update').html("Save");
}
}
});
很难帮助没有任何代码示例都没有。你能提供一个展示问题的jsFiddle或代码示例吗? – nukefusion 2013-03-01 14:28:16
你应该提供一些确切的代码,因为我已经尝试创建一个空网格并打开弹出式编辑器。模板是怎样的?你如何使用它? – OnaBai 2013-03-02 00:06:05
请检查上面编辑的问题。我已经把模板和剑道网格的代码。 – jugni 2013-03-04 08:35:13