我意识到这可能很愚蠢,这可能是因为我缺乏 javascript/jquery 知识(在重构等方面)
我正在像这样在我的页面上呈现一个 JQGrid 组件。
<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/JQGrid")" type="text/javascript"></script>
<script type="text/javascript">
var colNames = ['S ID', 'Shift Description'];
var colModel = [
{ name: 'S_ID', index: 'S_ID', key: true, width: 55, editable: false, hidden: true, search: false },
{ name: 'Shift_Description', index: 'Shift_Description', width: 100, align: "right", editable: true, editrules: { required: true }, formoptions: { rowpos: 1, colpos: 1}}];
RenderJQGrid("#theGrid", '#pager', '@ViewBag.Title', 600, colNames, colModel, 'S_ID', null, null, null, '@Url.Action("GridData")', '@Url.Action("Add")', '@Url.Action("Edit")', '@Url.Action("Delete")', '@Url.Action("ExportToExcel")');
</script>
在我的 .js 文件中,我只有这个。 (它也是 bundle 中的唯一文件)
function RenderJQGrid(GridID, PagerID, Title, ModalWidth, ColNames, ColModel, InitSortCol, OnLoadComplete, EditBeforeShowOptions, AddBeforeShowOptions, URL_get, URL_add, URL_edit, URL_delete, URL_excel) {
... Logic
}
不过我在 fiddler 中收到了这个错误。
/* Minification failed. Returning unminified contents.
(1,10): run-time error CSS1031: Expected selector, found 'RenderJQGrid('
(1,10): run-time error CSS1025: Expected comma or open brace, found 'RenderJQGrid('
*/
我做错了什么/遗漏了什么?当代码嵌入到我的 html 页面中时,它看起来没问题?
最佳答案
我遇到了类似的问题。我的问题是我使用 StyleBundle 来捆绑 *.js 文件
关于javascript - Asp.Net4 Javascript/jquery 缩小错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9905263/