Click here to Skip to main content
13,195,564 members (58,794 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have added all necesary Jquery & JqGrid scripts and css.
I am using MVC5.
i got "Uncaught TypeError: Cannot read property 'msie' of undefined" error.
So I have added jquery-migrate-1.2.1 script. after Jquery.

--warning msg JQMIGRATE: jQuery.browser is deprecated.

What I have tried:

$(document).ready(function () {
 
        debugger;
        $('.Importtbl').jqGrid({
            datatype: 'Json',
            mtype: 'GET',
            url: '@Url.Action("ImportData", "ReportablePayments")',
            colNames: ['PaymentDate', 'PayeeName', 'SrcDocType', 'Amount', 'Check Number', 'Object Code'],
            colModel: [
                { name: 'PaymentDate', index: 'PaymentDate', width: 20 },
                 { name: 'PayeeName', index: 'PayeeName', width: 50 },
                  { name: 'SrcDocType', index: 'SrcDocType', width: 20 },
                   { name: 'Amount', index: 'Amount', width: 15 },
                    { name: 'CheckNumber', index: 'CheckNumber', width: 20 },
                     { name: 'ObjectCode', index: 'ObjectCode', width: 10 }
 
            ],
            pager: '#pager',
            caption: 'Import Raw DATA',
            viewrecords: true,
            rowNum:10
        })
 
    });




----Controller.cs
public ActionResult ImportData(int rows,string sidx,string sord,int page)
{
return Json(null,JsonRequestBehavior.AllowGet);
}
Posted 12-Oct-17 5:40am
Updated 12-Oct-17 8:07am
v3
Comments
Bryian Tan 12-Oct-17 14:15pm
   
I don't see where in the posted code is referencing the plugin. Why the application need that plugin anyway?

By the way, why ImportData method is returning null to the jQGrid instead of JSON object?
Member 13461662 13-Oct-17 11:39am
   
This is my layout page
<!DOCTYPE html>


<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application
@Styles.Render("~/Content/css")












@Scripts.Render("~/bundles/modernizr")




@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })



@Html.ActionLink("Home", "Index", "Home")
@Html.ActionLink("About", "About", "Home")
@Html.ActionLink("Contact", "Contact", "Home")

@Html.Partial("_LoginPartial")
@RenderBody()

© @DateTime.Now.Year - My ASP.NET Application
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)



I am using this layout page in my view.

I am just trying to see empty table.instead of data. JqGrid is not calling ImportData method.

-----Controller.cs
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult ImportData(int rows,string sidx,string sord,int page)
{
return Json(null,JsonRequestBehavior.AllowGet);
}
Member 13461662 13-Oct-17 11:46am
   
I don't know some how my scripts are not posting here.
But i am using below scripts in layout page after
Styles.Render("~/Content/css")
jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.css
jquery.jqGrid-3.8.2/css/ui.jqgrid.css
jquery-3.2.1.min.js
jquery-migrate-1.4.1.js
jquery.mb.browser.js
jquery.jqGrid-3.8.2/js/i18n/grid.locale-en.js
jquery.jqGrid-3.8.2/js/jquery.jqGrid.min.js

Thank you so much for your response.
Member 13461662 13-Oct-17 11:56am
   
This is my BundleConfig.cs

public static void RegisterBundles(BundleCollection bundles)
{
//bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
// "~/Scripts/jquery-{version}.js"));

//bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
// "~/Scripts/jquery.validate*"));

//// Use the development version of Modernizr to develop with and learn from. Then, when you're
//// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}

I have commented Jquery scripts.because i am using scripts from layout.But I am using bootstrap and css from bundle which is rendered in layout page
Bryian Tan 13-Oct-17 11:56am
   
can you remove the plugin jQuery.browser and all references?
Member 13461662 13-Oct-17 13:27pm
   
Do you want me to remove below scripts..?

jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.css
jquery.jqGrid-3.8.2/css/ui.jqgrid.css
jquery-3.2.1.min.js
jquery-migrate-1.4.1.js
jquery.mb.browser.js
jquery.jqGrid-3.8.2/js/i18n/grid.locale-en.js
jquery.jqGrid-3.8.2/js/jquery.jqGrid.min.js
Bryian Tan 13-Oct-17 13:59pm
   
jquery.mb.browser.js --> assuming this is the one that obsolete?
Member 13461662 13-Oct-17 14:01pm
   
I have removed all the scripts related to jquery css,jqgrid,migrate and browser.js.
and uncommented the jquery scripts in bundle.config.
I got error saying "Uncaught TypeError: $(...).jqGrid is not a function"


Then I added JqGrid related plugins jqgrid.css,grid.locale-en.js,jqgrid.min.js in layout page after rendering the jquery scripts from bundle.config.
I got error saying " Cannot read property 'msie' of undefined"

Then I added jquery-migrate-1.4.1.js file in layout page before jqgrid scripts.
It's showing like warning msg"JQMIGRATE: jQuery.browser is deprecated" and not calling importDATA method.

Now I am not using jquery.mb.browser.js.still i have issue..
Member 13461662 13-Oct-17 15:22pm
   
It's working now..I did two mistakes.
1.order of the scripts.i have changed all scripts to header part of the layout page.earlier few scripts was rendering below the body part.
2.jqGrid id "Importtbl", i was mentioned it as class.

Thank you so much Bryian for your support.

Bryian Tan 14-Oct-17 1:01am
   
Glad you got it sorted out. Good job!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.171019.1 | Last Updated 12 Oct 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100