Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
function crashes alleging named Fields are undefined
26/03/2014
15:25
Avatar
joeller
Member
Members
Forum Posts: 4
Member Since:
29/01/2014
sp_UserOfflineSmall Offline

CryI have this function to establish my JqGrid.

$('#_visitorLogGrid').jqGrid({
        caption: paramFromView.Caption,
        colNames: ['FundDocLineID', paramFromView.Dodic, paramFromView.Line_Item, paramFromView.Orig_RDD, paramFromView.Fiscal_Year, paramFromView.FMS_Case],
        colModel: [
                    { name: 'FundDocLineID', index : FundDocLineID}, //width: 20, hidden: true, key: true },
                    { name: 'Dodic', index: 'Dodic', width: 300 },
                    { name: 'LineItem', index: 'LineItem', width: 150 },
                    { name: 'OrigRDD', index: 'OrigRDD', width: 150/*, formatter: datefmt*/},
                    { name: 'FiscalYear', index: 'FiscalYear', width: 120},
                    { name: 'FMSCase', index: 'FMSCase', width: 70, align: "center" }
        ],
        hidegrid: false,
        pager: jQuery('#_FundDocsEditPager'),
        sortname: 'FundDocLineID',
        rowNum: paramFromView.PageSize,
        rowList: [10, 20, 50, 100],
        sortorder: "asc",
        width: paramFromView.Width,
        height: paramFromView.Height,
        datatype: 'json',
        caption: paramFromView.Caption,
        viewrecords: true,
        mtype: 'GET',
        jsonReader: {
            root: "rows",
            page: "page",
            total: "total",
            records: "records",
            repeatitems: false,
            userdata: "userdata"
        },
        url: paramFromView.Url
    }).navGrid('#_visitorLogPager', { view: false, del: false, add: false, edit: false, search: false },
       { width: 400 }, // default settings for edit
       {}, // default settings for add
       {}, // delete instead that del:false we need this
       {}, // search options
       {} /* view parameters*/
     ).navButtonAdd('#_visitorLogPager', {
         caption: paramFromView.DeleteAllCaption, buttonimg: "", onClickButton: function () {
             if (confirm(paramFromView.DeleteAllConfirmationMessage)) {
                 document.location = paramFromView.ClearGridUrl;
             }
             else {
                 $('#_visitorLogGrid').resetSelection();
             }
         }, position: "last"
     });

However it is currently failing at line 7 column 5 with FundDocLineID is undefined.  I copied this code right out of the example at http://www.codeproject.com/Articles/594150/MVC-Basic-Site-Step-jqGrid-In  I altered it accordingto code at http://blogs.teamb.com/craigstuntz/2009/04/17/38229/  But the error persists.  (Interestingly enough the first code yesterday yielded object undefined at that location. Now the error has changed.)

Can someone point out where I went wrong?

27/03/2014
13:16
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Of course there will be a error:

replace

...

colModel: [
                    { name: 'FundDocLineID', index : FundDocLineID}

...

with thie one

...

colModel: [
                    { name: 'FundDocLineID', index : 'FundDocLineID'}

...

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

28/03/2014
15:48
Avatar
joeller
Member
Members
Forum Posts: 4
Member Since:
29/01/2014
sp_UserOfflineSmall Offline

Thank you for your prompt reply.

Yes I had that pointed out to me by someone else as well.  duh!

However now it is back to showing the original error, (which I mentioned at the end of my above post),

Unhandled exception at line 7, column 5 in http://localhost:51715/Scripts.....ildGrid.js

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method

28/03/2014
16:58
Avatar
joeller
Member
Members
Forum Posts: 4
Member Since:
29/01/2014
sp_UserOfflineSmall Offline

Revised function to look exactly like that provided on example page: http://haacked.com/archive/200.....-mvc.aspx/

$('#_FundDocsEditGrid').jqGrid({
        url
: "/FundDocs/GetData/",
        datatype
: 'json',
        mtype
: 'GET',
        caption
: paramFromView.Caption,
        colNames
: ['FundDocLineID', 'Dodic', 'Line Item', 'Orig RDD', 'Fiscal Year', 'FMS Case'],
        colModel
: [{ name: 'FundDocLineID', index: 'FundDocLineID', width: 1, hidden: true, key: true },
                   
{ name: 'Dodic', index: 'Dodic', width: 300 },
                   
{ name: 'LineItem', index: 'LineItem', width: 150 },
                   
{ name: 'OrigRDD', index: 'OrigRDD', width: 150/*, formatter: datefmt*/ },
                   
{ name: 'FiscalYear', index: 'FiscalYear', width: 120 },
                   
{ name: 'FMSCase', index: 'FMSCase', width: 70, align: "center" }
       
],

        pager: jQuery('#_FundDocsEditPager'),
        rowNum
: 10,
        rowList
: [10, 20, 50, 100],
        sortname
: 'FundDocLineID',
        sortorder
: "desc",
        viewrecords
: true,
        caption
: "Fund Docs Lines"
    
});

 

Error report

Unhandled exception at line 7, column 5 in http://localhost:51715/Scripts/FundDocsLinesShowGrid.js

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method

"$" of function is line 7 column 5 of file. 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
30 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information