jQWidgets Forums

jQuery UI Widgets Forums Grid Jscript Runtime Error with jqx is Undefined

This topic contains 4 replies, has 2 voices, and was last updated by  kalees 12 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • kalees
    Member

    Hi,

    I used jQWidjet grid evaluation version.

    When I tried to use, i got an issue at the page loading time itself with

    “JQuery Runtime error” with var dataAdapter = new $.jqx.dataAdapter(source); is undefined.

    I added all jquery supported files to this page. When i put cursor over jqx, i can see the object jqx with undefiend value.

    This is inside in the Document.Ready function only. Please see it and let me know if anything i missed out.

    Code:

    $(document).ready(function () {
    function getdata() {

    var source =
    {
    datatype: “json”,
    async: false,
    datafields: [
    { name: ‘Id’ },
    { name: ‘FileName’ },
    { name: ‘Link’ },
    { name: ‘UserName’ },
    { name: ‘ColorStatus’ }
    ],
    id: “id”,
    url: ‘api/ConvertedFiles/’
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    // //page rendering – anchor tag
    var pagerrenderer = function () {
    var element = $(“

    “);
    var paginginfo = $(“#jqxgrid”).jqxGrid(‘getpaginginformation’);
    for (i = 0; i < paginginfo.pagescount; i++) {
    // add anchor tag with the page number for each page.
    var anchor = $("” + i + ““);
    anchor.appendTo(element);
    anchor.click(function (event) {
    // go to a page.
    var pagenum = parseInt($(event.target).text());
    $(“#jqxgrid”).jqxGrid(‘gotopage’, pagenum);
    });
    }
    return element;
    }
    //For Report Link Button
    var makeAddToListButton_html = function (id, row, column, value) {
    var datarow = $(‘#jqxgrid’).jqxGrid(‘getcellvalue’, id, “Link”);
    //Link
    if (value.indexOf(‘#’) != -1) {
    value = value.substring(0, value.indexOf(‘#’));
    }
    var format = { target: ‘”_blank”‘ };
    var html = $.jqx.dataFormat.formatlink(datarow, format);
    // return html;
    return ‘Link
    //Button
    // return ”
    }
    // For Status Color display
    var makeAddTostatusButton_html = function (id, row, column, value) {

    var status = $(‘#jqxgrid’).jqxGrid(‘getcellvalue’, id, “ColorStatus”);
    var colvar = status;

    return ”
    }
    $(“#jqxgrid”).jqxGrid(
    {
    source: dataAdapter,
    pageable: true,
    autoheight: true,
    pagerrenderer: pagerrenderer,
    columns: [

    { text: ‘File Name’, dataField: ‘FileName’, width: 500 },
    { text: ‘Link’, cellsrenderer: makeAddToListButton_html, dataField: ‘Link’, width: 50 },
    { text: ‘Status’, cellsrenderer: makeAddTostatusButton_html, dataField: ‘ColorStatus’, width: 50 }

    ]
    });
    }
    Thanks in advance for your valuable reply.

    Regards
    Kalees


    Peter Stoev
    Keymaster

    Hi Kalees,

    If you receive that error, then the path to the referenced files is not correct or not all required files are referenced.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    kalees
    Member

    Hi Peter,

    I checked it and I given full path too. But it does not work for me.

    Ok. i tried the sample of getting started program too.

    but finally i got page error
    Webpage error details . If possible can u please help me with any of your simple sample apps.

    this will help me a lot.

    Is any license issue?

    anyhow see the details below for Error [I copied the sample code after the error details]

    Regards
    Kalees
    Error:
    ===============================================
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
    Timestamp: Mon, 30 Jul 2012 08:26:16 UTC

    Message: Invalid character
    Line: 1
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/scripts/jquery-1.6.2.min.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxcore.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxdata.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxbuttons.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxscrollbar.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxmenu.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxgrid.js

    Message: ‘jQuery’ is undefined
    Line: 7
    Char: 1
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jqwidgets/jqxgrid.selection.js

    Message: Object expected
    Line: 35
    Char: 5
    Code: 0
    URI: file:///C:/Kalees/Task/Pract/jQWidget/jQWidget.html

    ======================
    I Copied the sample code here
    =====================

    // prepare the data
    var data = new Array();
    var firstNames = [“Andrew”, “Nancy”, “Shelley”, “Regina”, “Yoshi”, “Antoni”, “Mayumi”, “Ian”, “Peter”, “Lars”, “Petra”, “Martin”, “Sven”, “Elio”, “Beate”, “Cheryl”, “Michael”, “Guylene”];
    var lastNames = [“Fuller”, “Davolio”, “Burke”, “Murphy”, “Nagase”, “Saavedra”, “Ohno”, “Devling”, “Wilson”, “Peterson”, “Winkler”, “Bein”, “Petersen”, “Rossi”, “Vileid”, “Saylor”, “Bjorn”, “Nodier”];
    var productNames = [“Black Tea”, “Green Tea”, “Caffe Espresso”, “Doubleshot Espresso”, “Caffe Latte”, “White Chocolate Mocha”, “Cramel Latte”, “Caffe Americano”, “Cappuccino”, “Espresso Truffle”, “Espresso con Panna”, “Peppermint Mocha Twist”];
    var priceValues = [“2.25”, “1.5”, “3.0”, “3.3”, “4.5”, “3.6”, “3.8”, “2.5”, “5.0”, “1.75”, “3.25”, “4.0”];
    for (var i = 0; i < 1000; i++) {
    var row = {};
    var productindex = Math.floor(Math.random() * productNames.length);
    var price = parseFloat(priceValues[productindex]);
    var quantity = 1 + Math.round(Math.random() * 10);
    row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
    row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
    row["productname"] = productNames[productindex];
    row["price"] = price;
    row["quantity"] = quantity;
    row["total"] = price * quantity;
    data[i] = row;
    }
    var source = { localdata: data, datatype: "array" };

    $("#jqxgrid").jqxGrid({
    source: source,
    columns: [{ text: 'First Name', datafield: 'firstname', width: 100 },
    { text: 'Last Name', datafield: 'lastname', width: 100 },
    { text: 'Product', datafield: 'productname', width: 180 },
    { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
    { text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
    { text: 'Total', datafield: 'total', width: 100, cellsalign: 'right', cellsformat: 'c2'}]
    });


    Peter Stoev
    Keymaster

    Hi kalees,

    Message: ‘jQuery’ is undefined means that jQuery is not included/referenced. Please, take a look at the samples included in the download package. They are tested and will work. In addition, the download package includes jQuery 1.7.2, not 1.6.2.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    kalees
    Member

    Hi Peter,

    Thank you for you help.

    The sample is working fo me.

    I am trying now with my actual problem which i posted earlier.

    i will come back after some practice.

    Regards
    Kalees

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.