我意识到这可能很愚蠢,可能是因为我缺乏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文件中,我只有这个。(它也是捆绑包中唯一的文件)
function RenderJQGrid(GridID, PagerID, Title, ModalWidth, ColNames, ColModel, InitSortCol, OnLoadComplete, EditBeforeShowOptions, AddBeforeShowOptions, URL_get, URL_add, URL_edit, URL_delete, URL_excel) {
... Logic
}
不过我在fiddler中收到了这个错误
/*最小化失败。返回未合并的内容。
(1,10):运行时错误CSS1031:预期的选择器,找到'RenderJQGrid'
(1,10):运行时错误CSS1025:应为逗号或大括号,找到'RenderJQGrid'
*/
我做错了什么/错过了什么?当代码嵌入到我的html页面中时,它看起来很好?
我遇到了类似的问题。我的问题是,我使用StyleBundle捆绑*.js文件