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
You should include
jsonReader: {
repeatitems: false,
root: function (obj) { return obj; },
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.length; }
}
as additional option of jqGrid is you don't want to change format of input data. Moreover you should specify which values should assign jqGrid as id
attribute of the row. You can include additional id
property as additional property of every returned item or you can add key: true
property to the column (in colModel
) which contains unique values. For example if you can guarantied that the values from "name"
are already unique then you can include key: true
property in definition of "name"
column.
Additionally you can consider to use loadonce: true
option of jqGrid. In the case the full data of the grid will be loaded at once and the sorting, paging and searching (filtering) of data will be implemented by jqGrid on the client side without needs to implement some additional code on the server side. You should don't use the option in case of large number of rows (many hundred or many thousand rows) in the grid.