2

I have used 3.8.2 JQGrid file jquery.jqGrid.min.js which is only needed file with all the modules in it which will be selected from there side while downloading which is not working with one of the error = }).navGrid is not a function.

I than downloaded tonytomov-jqGrid-c3a2a2d folder from http://github.com/tonytomov/jqGrid/tree/master and used it which has path to all the modules residing in js folder and working fine. Below is the jquery.jqGrid.js file from github. I know jquery.jqGrid.js is for development purpose but jquery.jqGrid.min.js not working for me at all.

Why is that?. I have experimented alot and thats what I have found. May be I am missing something.

//This file should be used if you want to debug and develop
function jqGridInclude()
{
    var pathtojsfiles = "/Scripts/js/"; // need to be ajusted
    // set include to false if you do not want some modules to be included
    var modules = [
        { include: true, incfile:'i18n/grid.locale-en.js'}, // jqGrid translation
        { include: true, incfile:'grid.base.js'}, // jqGrid base
        { include: true, incfile:'grid.common.js'}, // jqGrid common for editing
        { include: true, incfile:'grid.formedit.js'}, // jqGrid Form editing
        { include: true, incfile:'grid.inlinedit.js'}, // jqGrid inline editing
        { include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing
        { include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid
        { include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid
        { include: true, incfile:'grid.grouping.js'}, //jqGrid grouping 
        { include: true, incfile:'grid.custom.js'}, //jqGrid custom 
        { include: true, incfile:'grid.postext.js'}, //jqGrid postext
        { include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid
        { include: true, incfile:'grid.setcolumns.js'}, //jqGrid setcolumns
        { include: true, incfile:'grid.import.js'}, //jqGrid import
        { include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater
        { include: true, incfile:'JsonXml.js'}, //xmljson utils
        { include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils
        { include: true, incfile:'jquery.searchFilter.js'} // search Plugin
    ];
    var filename;
    for(var i=0;i<modules.length; i++)
    {
        if(modules[i].include === true) {
            filename = pathtojsfiles+modules[i].incfile;
            if(jQuery.browser.safari) {
                jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
            } else {
                if (jQuery.browser.msie) {
                    document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
                } else {
                    IncludeJavaScript(filename);
                }
            }
        }
    }
    function IncludeJavaScript(jsFile)
    {
        var oHead = document.getElementsByTagName('head')[0];
        var oScript = document.createElement('script');
        oScript.setAttribute('type', 'text/javascript');
        oScript.setAttribute('language', 'javascript');
        oScript.setAttribute('src', jsFile);
        oHead.appendChild(oScript);
    }
}
jqGridInclude();

//My Js

jQuery().ready(function () {
    var lastSel;
    jQuery("#sandgrid").jqGrid({
        url: '/JQSandbox/MyGridData/',
        datatype: 'json',
        mtype: 'POST',
        height: 255,
        width: 640,
        colNames: ['Index', 'Name', 'City', 'State'],
        colModel: [
                { name: 'companyID', index: 'companyID', width: 5 },
                { name: 'companyName', index: 'companyName', width: 30 },
                { name: 'companyCity', index: 'companyCity', width: 30 },
                { name: 'companyState', index: 'companyState', width: 4, sortable: false}],

        pager: jQuery('#sandgridp'),
        rowNum: 5,
        rowList: [5, 10, 20, 50],
        sortname: 'companyID',
        sortorder: "desc",
        viewrecords: true,
        altRows: true,
        caption: 'Sandbox Grid',
        ondblClickRow: function (id) {
            if (id && id !== lastSel) {
                jQuery('#sandgrid').restoreRow(lastSel);
                lastSel = id;
                alert("You've seleted " + id);
            }
        },
        subGrid: true,
        subGridUrl: '/JQSandbox/MySubGridData/',
        subGridModel: [
        {
            name: ['Name', 'Department', 'Hire Date', 'Supervisor'],
            width: [80, 20, 80, 10],
            align: ['left', 'left', 'left', 'center'],
            params: ['companyID']
        }]
    }).navGrid('#sandgridp', { edit: false, add: false, del: false });

});
Pirzada
  • 4,685
  • 18
  • 60
  • 113
  • Please include in the text of your question the "Module" list from the comment at the beginning of `jquery.jqGrid.min.js`, which I described http://stackoverflow.com/questions/4477926/uncaught-exception-jqgrid-no-such-method-navgrid/4478136#4478136. – Oleg Dec 19 '10 at 07:43
  • jquery.jqGrid.min.js = * Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; jquery.searchFilter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.setcolumns.js; grid.postext.js; grid.tbltogrid.js; grid.jqueryui.js; has all these modules downloaded. I put jquery.jqGrid.min.js in scripts folder and in js folder all the modules mentioned above. Still not working. Tried moving file in the same folder but no success. :( – Pirzada Dec 19 '10 at 07:52
  • Oleg can you reply to this question as well. This question has reference link where you have posted answer with code but I can not make it work. http://stackoverflow.com/questions/4482060/jqgrid-problem-with-sorting-linq-expression – Pirzada Dec 19 '10 at 07:54
  • I will try to answer both your questions later in some hours. To answer on the other question I need definition of the `Company` class and the definition of the corresponding jqGrid. – Oleg Dec 19 '10 at 09:07

1 Answers1

3

How one can see in the comment of jquery.jqGrid.min.js

Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; jquery.searchFilter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.setcolumns.js; grid.postext.js; grid.tbltogrid.js; grid.jqueryui.js;

you selected all jqGrid modules with exception grid.formedit.js. In the jqGrid download page it has the name "Form Edit" (see "Editing" group). I tested and I can download now all modules from the jqGrid download page. So it should be not a technical problem.

So you should just download the jqGrid one more time and you will not have any problems with the usage of navGrid in jquery.jqGrid.min.js.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • downloaded again Modules: grid.base.js; jquery.fmatter.js; grid.custom.js; grid.common.js; grid.formedit.js; jquery.searchFilter.js; grid.inlinedit.js; grid.celledit.js; jqModal.js; jqDnR.js; grid.subgrid.js; grid.grouping.js; grid.treegrid.js; grid.import.js; JsonXml.js; grid.setcolumns.js; grid.postext.js; grid.tbltogrid.js; grid.jqueryui.js; . But I get error b.jgrid.formatter is undefined [Break On This Error] "";s+=a.p.toppager?s?","+a.p.toppager:...=b.fmatter.util.NumberFormat(w,G);C= . I have added my JS code. :( – Pirzada Dec 20 '10 at 02:57
  • 1
    I googled for the problem and found that its due to language file. Fixed it and working fine. Thanks alot for the help. Hope to get reply from you frequently as I am testing JQGrid alot. – Pirzada Dec 20 '10 at 03:05