1

I realize this might be stupid, and its probably caused by my lack of javascript/jquery knowledge (in terms of re-factoring etc..)

I'm rendering a JQGrid component on my page like this.

<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>

Inside my .js file, I only have this. (it's also the only file in the bundle)

function RenderJQGrid(GridID, PagerID, Title, ModalWidth, ColNames, ColModel, InitSortCol, OnLoadComplete, EditBeforeShowOptions, AddBeforeShowOptions, URL_get, URL_add, URL_edit, URL_delete, URL_excel) {

   ... Logic
}

I'm receiving this error in fiddler though.

/* 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('

*/

what am i doing wrong/missing? the code seemed fine when it was embedded inside my html page?

1 Answer 1

7

I ran into a similar problem. My issue was that I was using a StyleBundle to bundle *.js files

Sign up to request clarification or add additional context in comments.

1 Comment

no I had to change the code to use ScriptBundle instead. Works great now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.