jQWidgets Forums
Forum Replies Created
-
Author
-
February 22, 2012 at 6:33 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2404
The working COde Thank you again
February 22, 2012 at 6:32 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2403Hello Peter,
I Got it working, i dont know what i did but its working now.
//my table`EmployeeID` int(11) NOT NULL AUTO_INCREMENT,
`LastName` varchar(20) NOT NULL,
`FirstName` varchar(10) NOT NULL,
`Title` varchar(30) DEFAULT NULL,
`TitleOfCourtesy` varchar(25) DEFAULT NULL,
`BirthDate` datetime DEFAULT NULL,
`HireDate` datetime DEFAULT NULL,
`Address` varchar(60) DEFAULT NULL,
`City` varchar(15) DEFAULT NULL,
`Region` varchar(15) DEFAULT NULL,
`PostalCode` varchar(10) DEFAULT NULL,
`Country` varchar(15) DEFAULT NULL,
`HomePhone` varchar(24) DEFAULT NULL,
`Extension` varchar(4) DEFAULT NULL,
`Photo` longblob,
`Notes` longtext,
`ReportsTo` int(11) DEFAULT NULL,
`PhotoPath` varchar(255) DEFAULT NULL,
PRIMARY KEY (`EmployeeID`),
KEY `LastName` (`LastName`),
KEY `PostalCode` (`PostalCode`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;// data.php
$row['EmployeeID'],
'FirstName' => $row['FirstName'],
'LastName' => $row['LastName'],
'Title' => $row['Title'],
'Address' => $row['Address'],
'City' => $row['City'],
'Country' => $row['Country'],
'Notes' => $row['Notes']
);
}echo json_encode($employees);
}
?>
// index.php$(document).ready(function () {
// prepare the data
var theme = 'classic';var source =
{
datatype: "json",
datafields: [
{ name: 'EmployeeID'},
{ name: 'FirstName'},
{ name: 'LastName'},
{ name: 'Title'},
{ name: 'Address'},
{ name: 'City'},
{ name: 'Country'},
{ name: 'Notes'}
],
url: 'data.php',
root: 'Rows',
addrow: function (rowid, rowdata) {
// synchronize with the server - send insert command
var data = "insert=true&" + $.param(rowdata);
$.ajax({
dataType: 'json',
url: 'data.php',
data: data,
success: function (data, status, xhr) {
// insert command is executed.
}
});
},
deleterow: function (rowid) {
// synchronize with the server - send delete command
var data = "delete=true&EmployeeID=" + rowid;
$.ajax({
dataType: 'json',
url: 'data.php',
data: data,
success: function (data, status, xhr) {
// delete command is executed.
}
});
},
updaterow: function (rowid, rowdata) {
// synchronize with the server - send update command
var data = "update=true&" + $.param(rowdata);
$.ajax({
dataType: 'json',
url: 'data.php',
data: data,
success: function (data, status, xhr) {
// update command is executed.
}
});
}};
var dataadapter = new $.jqx.dataAdapter(source);
// initialize jqxGrid
$("#jqxgrid").jqxGrid(
{
width: 600,
source: dataadapter,
theme: theme,
autoheight: true,
pageable: true,
virtualmode: true,
rendergridrows: function()
{
return dataadapter.records;
},
columns: [
{ text: 'EmployeeID', datafield: 'EmployeeID', width: 100 },
{ text: 'First Name', datafield: 'FirstName', width: 100 },
{ text: 'Last Name', datafield: 'LastName', width: 100 },
{ text: 'Title', datafield: 'Title', width: 180 },
{ text: 'Address', datafield: 'Address', width: 180 },
{ text: 'City', datafield: 'City', width: 100 },
{ text: 'Country', datafield: 'Country', width: 140 },
{ text: 'Notes', datafield: 'Notes', width: 140 }
]
});
$("#addrowbutton").jqxButton({ theme: theme });
$("#deleterowbutton").jqxButton({ theme: theme });
$("#updaterowbutton").jqxButton({ theme: theme });// update row.
$("#updaterowbutton").bind('click', function () {
var datarow = generaterow();
var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
if (selectedrowindex >= 0 && selectedrowindex = 0 && selectedrowindex < rowscount) {
var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
$("#jqxgrid").jqxGrid('deleterow', id);
}
});});
Here is the working Code Also for everyone who is looking for a sample working code. There is another problem
Uncaught ReferenceError: generaterow is not defined
(anonymous function)/jqxwidgets/:123
f.event.dispatchjquery-1.7.1.min.js:4
f.event.add.h.handle.iI dont know what to do with this.
February 22, 2012 at 5:20 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2401Ok sir, thank you for your time. I’ll try to correct the references. Thank you
February 22, 2012 at 5:02 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2399February 22, 2012 at 4:53 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2398To add more at the console it says
a.jqx is undefined
February 22, 2012 at 4:43 pm in reply to: b.jqx.dataAdapter is not a constructor b.jqx.dataAdapter is not a constructor #2397Hello, Thank you for your reply
I added the reference to the script as stated and i followed it and converted to PHP to JSON their where no errors, but i notice this in the Firebug , it keeps Highlighting this part of the jqxgrid.js(function(b){b.jqx.jqxWidget("jqxGrid","",{});b.extend(b.jqx._jqxGrid.prototype,{defineInstance:function(){this
Thank you in advance.
-
AuthorPosts