IM using jqgrids on mvc4, I need to get a simple list and display it using Ajax.
When I load the page then grid starts an Ajax call, I have only 2 columns on grid, u
Add a reference to the jqgrid locale file first followed by jqrid
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/i18n/grid.locale-en.js"></script>
<script src="https://cdn.jsdelivr.net/jqgrid/4.6.0/jquery.jqGrid.min.js"></script>
One get the error message typically if one don't included required language file grid.locale-XX.js
(for example grid.locale-en.js
) before jquery.jqGrid.min.js
or jquery.jqGrid.src.js
. See the example of the usage of jqGrid in the documentation.
Additionally I would recommend you to add gridview: true
and autoencode: true
option to jqGrid, remove non-existing myType: 'GET'
(there are mtype
option which default value if "GET"
), reduce jsonReader
to jsonReader: {repeatitems: false, id: "user_id"}
, remove all index
properties from colModel
(because you use the values the same as the value of name
property) and add key: true
to definition of 'user_id'
column.
Because you don't implemented server side paging of data I would recommend you add additionally loadonce: true
option. It allows you to return all data at once from UsuariosGridData
and jqGrid will implement client side sorting, paging or optionally filtering/searching of data.