Hello StackOverFlow nation . I\'m trying to add information to jqGrid , which is retrieved from MySQL database. I\'ve two files => index.html and data.php (both in the same dire
Your response format is wrong. You can go to jqGrid Demos page where you will find a sample for PHP/MySQL after expanding Loading Data and then choosing JSON Data.
The proper format of data should look like this:
{
"total": "1",
"page": "1",
"records": "2",
"rows": [
{ "name": "Robert", "surname": "De Niro", "b_year": "1943", "film": "Once Upon A Time In America" },
{ "name": "Al", "surname": "Pacino", "b_year":"1971", "film": "Scent Of A Woman"}
]
}
Where:
total
--> total count of pagespage
--> current page numberrecords
--> total count of recordsrows
--> the rows of dataAlso if you want rows to be objects, you need to disable repeatitems
in jqGrid jsonReader
options:
$("#jqGrid_tb").jqGrid({
...
jsonReader: { repeatitems: false }
});
It is also adviced for rows to have unique id
for later reference.