Bat*_*rog 0 kendo-ui kendo-grid
我试图将一个字符串从kendo数据源传递到网格中的模板,该模板充当"打印"按钮.该按钮触发一个函数,打开一个到报表服务器的新链接,我需要将一个字符串值传递给该函数,以便在该URL中发送字符串值.
如果我发送数据源Id字段,我有它的工作,但如果我尝试发送一个字符串值(医生),我得到一个'意外的标识符'错误.我试过改变coluns:field:to Physician,但是得到了同样的错误.
编辑:我可以传递任何int值,但如果我尝试发送一个字符串它会中断.
如何将Id以外的值传递给我的模板?
schema: {
model: {
id: "Id",
fields: {
"ClinicName": { type: "string" },
"Physician": { type: "string" },
"Phone": { type: "string" },
"Fax": { type: "string" },
"Specialty": { type: "string" },
"Consent": { type: "date" }
}
}
},
pageSize: 10
});
function printForm(Physician) {
var stuid = $('#sisid').html().match(/\d+/);
var user = $('#user').val();
var sid = $('#sess').val();
window.open("http://@reportServer/ReportServer/Pages/ReportViewer.aspx?/SHPN/Treatment%20Form&rs:Command=Render&StudentId=" + stuid + "&SessionId=" + sid + "&CurrentUser=" + user + "&Physician=" + Physician);
};
$(document).ready(function () {
columns: [
{
field: "Id",
width: "38px",
title: "Print",
filterable: false,
sortable: false,
template: "<a class='change-image' href='javascript:void(0);' title='Print Treatment Form' onclick='printForm(#= Id #)'><img alt='Student Info' src='@Url.Content("~/Content/Images/printer-icon.png")' /></a>"
},
Run Code Online (Sandbox Code Playgroud)
既然Physician是一个string你可能不正确地逃避它.尝试将模板定义为:
template: "<a class='change-image' href='javascript:void(0);' title='Print Treatment Form' onclick='printForm(\"#= Physician #\")'><img alt='Student Info' src='@Url.Content("~/Content/Images/printer-icon.png")' /></a>"
Run Code Online (Sandbox Code Playgroud)
在这里查看:http://jsfiddle.net/OnaBai/ZwXa2/
| 归档时间: |
|
| 查看次数: |
2752 次 |
| 最近记录: |