jQWidgets Forums
jQuery UI Widgets › Forums › Grid › shows error $.jqx is undefined
Tagged: undefined error
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 9 months ago.
-
Author
-
Hello,
I am using jqxgrid binding with json using php. it show me error $.jqx is undefined. I am calling grid using ajax call.
Please tell me what could be the possibilities.
Thanks,
NeelamHi Neelam,
I suggest you to check whether all javascript files are included correctly in your project and you don’t try to call a method or set a property of something which is still not loaded.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello,
I tried a dummy setup for grid which is working. with below code. same code I am using to replace a div with grid using ajax call but its not working.
headLink()->appendStylesheet($this->baseUrl().’/scripts/jqwidgets/styles/jqx.base.css’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jquery-1.7.2.min.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxcore.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxbuttons.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxscrollbar.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxmenu.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxcheckbox.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxlistbox.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxdropdownlist.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxgrid.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxgrid.selection.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxgrid.columnsresize.js’) ?>
headScript()->appendFile($this->baseUrl().’/scripts/jqwidgets/jqxdata.js’) ?>$(document).ready(function () {
var url = SITEDOMAIN+”/dashboards/data”;
var parentsLength = $(“#jqxWidget”).parents().length;
if (parentsLength > 3) {
url = SITEDOMAIN+”/dashboards/data”;
}
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘mth’ },
{ name: ‘total’, type: ‘int’ }
],
id: ‘id’,
url: url,
root: ‘data’
};
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
width: 670,
source: dataAdapter,
columnsresize: true,
columns: [
{ text: ‘First Name’, dataField: ‘mth’, width: 100 },
{ text: ‘Total’, dataField: ‘total’, cellsalign: ‘right’, minwidth: 100, cellsformat: ‘c2’ }
]
});
});Thanks,
NeelamMay be you should append dynamically your document.ready call, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.