javascript - Asp.Net4 Javascript/jquery 缩小错误

标签 javascript jquery refactoring asp.net-mvc-4

我意识到这可能很愚蠢,这可能是因为我缺乏 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/

相关文章:

javascript - jQuery 显示从左侧隐藏滑动面板

javascript - 如何在lodash中删除数组中的对象

javascript - 使 if/else if 语句不那么笨拙。新手在这里

perl - 如何重构 for 循环中发生的递归以使其成为尾调用?

javascript - jQuery 函数忽略增量值

javascript - 容器从上到下匹配导航栏

jquery - Cakephp:使多个复选框表现得像单选按钮

php - 菜单页面状态

jQuery ui-effects-wrapper 在使用 .show ("slide"时砍掉 div 内容的底部,

python - 在 Python 中重构 For 循环