Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery jqgrid在IE8和firefox 3.6.6中不工作_Jquery_Asp.net_Asp.net Mvc_Jqgrid - Fatal编程技术网

Jquery jqgrid在IE8和firefox 3.6.6中不工作

Jquery jqgrid在IE8和firefox 3.6.6中不工作,jquery,asp.net,asp.net-mvc,jqgrid,Jquery,Asp.net,Asp.net Mvc,Jqgrid,我的jqgrid可以在Firefox7和IE9中使用,但不能在IE8或Firefox3.6.6中使用。我正在使用最新版本的jqgrid 以下是我包含的脚本文件: <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <link href="@Url.Content("~/Content/themes/ui-lightness/jquery.ui.all.

我的jqgrid可以在Firefox7和IE9中使用,但不能在IE8或Firefox3.6.6中使用。我正在使用最新版本的jqgrid

以下是我包含的脚本文件:

  <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/ui-lightness/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/ui.jqgrid.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/ui.multiselect.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/ui-lightness/jquery-ui-1.8.16.custom.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/grid.locale-en.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/ui/minified/jquery.ui.core.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/ui/minified/jquery.ui.widget.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/ui/minified/jquery.ui.mouse.min.js")" type="text/javascript"></script>

这是我的脚本,以防需要:

 $(document).ready(function () {

        $('#jobs').jqGrid({
            url: '/SearchJob/Jobs/',
            postData: {
                'JobTitle': function () { return $('#JobTitle').val(); },
                'City': function () { return $('#City').val(); },
                'SelectJobType': function () { return $('#SelectJobType option:selected').val(); },
                'SalaryStartRange': function () { return $('#SalaryStartRange').val(); },
                'SalaryEndRange': function () { return $('#SalaryEndRange').val(); },
                'SelectCategory': function () { return $('#SelectCategory option:selected').val(); },
                'SelectIndustry': function () { return $('#SelectIndustry option:selected').val(); },
                'CompanyName': function () { return $('#CompanyName').val(); },
                'Keywords': function () { return $('#Keywords').val(); },
                'SelectSalaryType': function () { return $('#SelectSalaryType option:selected').val(); }
            },
            datatype: 'json',
            mtype: 'POST',
            colNames: ['Title', 'Category', 'Company Name', 'Location', 'Salary Range', 'Date Posted'],
            colModel: [
                { name: 'Title', index: 'title', width: 150, align: 'left', formatter: 'showlink', formatter: linkformatter },
                { name: 'Category', index: 'Category', width: 150, align: 'center' },
                { name: 'CompanyName', index: 'CompanyName', width: 150, align: 'center' },
                { name: 'CombinedLocation', index: 'CombinedLocation', width: 150, align: 'center' },
                { name: 'salaryRange', index: 'salaryRange', width: 150, align: 'center' },
                { name: 'DatePosted', index: 'DatePosted', width: 150, align: 'center' },
            ],
            shrinkToFit: true,
            rownumbers: true,
            loadonce: false,
            pager: jQuery('#jobPager'),
            rowNum: 10,
            rowList: [5, 10, 20, 50],
            sortname: 'jobid',
            sortorder: "desc",
            viewrecords: true,
            imgpath: '',
            caption: 'Jobs',
            width: '100%',
            height: "100%"
        });
        $('#search').click(function () {
            $('#jobs').trigger('reloadGrid');
            return false;
        });



    });

    linkformatter = function (cellValue, opts, rowObject) {
        console.log(rowObject);
        return "<a href='@Url.Action("JobView", "RecruiterProfile")/" + rowObject[rowObject.length - 1] +  "'>" + cellValue + "<a/>"; 
    }
$(文档).ready(函数(){
$(“#作业”).jqGrid({
url:“/SearchJob/Jobs/”,
postData:{
“JobTitle”:函数(){return$(“#JobTitle”).val();},
'City':函数(){return$('#City').val()},
“SelectJobType”:函数(){return$(“#SelectJobType选项:selected”).val();},
“SalaryStartRange”:函数(){return$(“#SalaryStartRange”).val();},
“SalaryEndRange”:函数(){return$(“#SalaryEndRange”).val();},
“SelectCategory”:函数(){return$(“#SelectCategory选项:selected”).val();},
“SelectIndustry”:函数(){return$(“#SelectIndustry选项:selected”).val();},
“CompanyName”:函数(){return$(“#CompanyName”).val();},
“关键字”:函数(){return$(“#关键字”).val();},
“SelectSalaryType”:函数(){return$(“#SelectSalaryType选项:selected”).val();}
},
数据类型:“json”,
mtype:“POST”,
colNames:['Title'、'Category'、'Company Name'、'Location'、'Salary Range'、'Date Posted'],
colModel:[
{name:'Title',index:'Title',width:150,align:'left',格式化程序:'showlink',格式化程序:linkformatter},
{名称:'Category',索引:'Category',宽度:150,对齐:'center'},
{name:'CompanyName',index:'CompanyName',宽度:150,对齐:'center'},
{名称:'CombinedLocation',索引:'CombinedLocation',宽度:150,对齐:'center'},
{name:'salaryRange',index:'salaryRange',宽度:150,对齐:'center'},
{名称:'DatePosted',索引:'DatePosted',宽度:150,对齐:'center'},
],
shrinkToFit:是的,
行数:对,
loadonce:false,
pager:jQuery(“#jobPager”),
rowNum:10,
行列表:[5,10,20,50],
sortname:'jobid',
巫师:“描述”,
viewrecords:是的,
imgpath:“”,
描述:“工作”,
宽度:“100%”,
身高:“100%”
});
$(“#搜索”)。单击(函数(){
$(“#作业”).trigger('reloadGrid');
返回false;
});
});
linkformatter=函数(单元格值、选项、行对象){
console.log(rowObject);
返回“+cellValue+”;
}
附件是我在IE8和Firefox 3.6中遇到的错误:

删除截图,因为我不允许发布。如果将来有人到这里来,那就是控制台的错误。从我的格式化程序函数中删除,它工作了


更新:只有在禁用Firebug的情况下,Firefox 3.6才会出现错误。我启用了Firebug,一切正常。我做错了什么?我是否包含了错误的脚本文件?

我认为您应该编写

window.console.log(rowObject);
代替

console.log(rowObject);
或者你可以从这里得到答案


我认为你应该写

window.console.log(rowObject);
代替

console.log(rowObject);
或者你可以从这里得到答案

在IE8或Firefox 3.6.6中,它不支持console对象。当您删除它时,它将工作


在IE8或Firefox 3.6.6中,它没有控制台对象。当您删除它时,它将起作用。

在最后一个“更新”部分中,您几乎回答了自己的问题:您必须进行测试

if (window.console) {
    window.console.log(rowObject);
}


因为控制台并不总是存在。

在上一个“更新”部分,你几乎回答了自己的问题:你必须测试

if (window.console) {
    window.console.log(rowObject);
}


因为控制台并不总是存在。

谢谢Oleg。实际上它是在本地主机上运行的,但错误出现在客户端的浏览器中:p.Oleg。实际上它是在本地主机上运行的,但错误出现在客户端的浏览器中:p.Okkkk。。很好,因为你是第一个解决我问题的人。我接受你的回答。好的。。很好,因为你是第一个解决我问题的人。我接受你的回答。