Mallik Kumar
Mallik Kumar

Reputation: 550

"Uncaught TypeError: undefined is not a function"

I am new to jqxGrid. I am trying to populate the grid after a ajax call to an PHP file and then reload. My code is:

    $(document).ready(function () {
            var url = "searchresults.php";
            // prepare the data
            var source =
            {
                datatype: "json",
                datafields: [
                    { name: 'ids', type:"string"},
                    { name: 'loc', type:"string" },
                    { name: 'name', type:"string"},
                    { name: 'tld', type: "string" },
                    { name: 'wc', type: "int" }
                ],
                id: 'id',
                url: url,
                root: 'data'
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            $("#outgrid").jqxGrid(
            {
                width: 850,
                source: dataAdapter,
                //columnsresize: true,
                columns: [
                  { text: 'IDs', dataField: 'IDs', width: 200 },
                  { text: 'LOCATION', dataField: 'loc', width: 200 },
                  { text: 'DOMAINS', dataField: 'name', width: 180 },
                  { text: 'TLD', dataField: 'tld', width: 90, cellsalign: 'right' },
                  { text: 'WORD COUNT', dataField: 'wc', cellsalign: 'right', minwidth: 100}
                ]
            });
        });

The error occurs at the line:

    $("#outgrid").jqxGrid(

I don't understand. My dependencies are:

    <script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
    <link rel="stylesheet" href="jqx/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="jqx/jqxcore.js"></script>
    <script type="text/javascript" src="jqx/jqxdata.js"></script> 
    <script type="text/javascript" src="jqx/jqxbuttons.js"></script>
    <script type="text/javascript" src="jqx/jqxscrollbar.js"></script>
    <script type="text/javascript" src="jqx/jqxmenu.js"></script>
    <script type="text/javascript" src="jqx/jqxdatatable.js"></script>

Upvotes: 0

Views: 2523

Answers (1)

Jon Egerton
Jon Egerton

Reputation: 41589

The getting started example here has a script link for a jqxgrid.js file (plus a load of add-ins).

I don't see that on yours? Do you definitely have one?

Note that jqxDataTable (which you do reference) is a completely different control, the startup guide for which is here, and which is referenced using $(...).jqxDataTable(... instead of $(...).jqxGrid(...

Upvotes: 1

Related Questions