Начал изучение Jqgrid, все неплохо, но с этим встал в тупик.
Необходимо одному из полей в colmodel назначить тип "select". С подгружаемыми данными из бд. Поле становиться нужного типа, вот только данные в него не подгружаются. Грешил поначалу на неправильный формат файла который забирает данные из бд и отдает их полю. Прописал в "editoption" данные в виде строки. Тот же результат - select пуст. Уверен что проблема в мелочи, но никак не пойму в какой.
Буду безмерно рад Вашей помощи. Спасибо.
Вот мой jqgrid:
CODE (html):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=cp1251" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <title>Kor10</title>
- <link rel="stylesheet" type="text/css" media="screen" href="css/ui-cupertino/jquery-ui.css" />
- <link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
- <style>
- html, body {
- margin: 0;
- padding: 0;
- font-size: 75%;
- }
- </style>
- <script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
- <script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
- <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
- <script type="text/javascript" src="js/jqDnR.js"></script>
- <script type="text/javascript" src="js/grid.common.js"></script>
- <script type="text/javascript" src="js/jquery-ui.js"></script>
- </head>
- <body>
- <table id="ndvjmst"><tr><td></td></tr></table>
- <div id="pager_nd"></div>
- <script type="text/javascript">
- $(function () {
- var lastSelection;
- $("#ndvjmst").jqGrid({
- url:'nd_get.php',
- datatype: "xml",
- mtype: "POST",
- colNames: ["id", "Номер", "Тип недвижимости","Право владения","Площадь"],
- colModel: [
- { name: "id", width: 55},
- { name: "nomer", width: 250, editable: true},
- { name: "type", index:"type", width: 200, editable: true, formatter: "select", edittype:"select",editoption: { value: "1:Квартира; 2:Офис; 3:машино-место" }},
- { name: "pravo", width: 80, editable: true},
- { name: "plohad", width: 150, align: "right",editable: true},
- ],
- pager: "#pager_nd",
- rowNum: 10,
- rowList: [10, 20, 30],
- sortname: "id",
- sortorder: "desc",
- viewrecords: true,
- gridview: true,
- autoencode: true,
- editurl:'nd_set.php',
- caption: "Недвижимость - Кор10",
- onCellSelect: function (rowid, iCol, cellContent, e) {
- $("#ndvjmst").restoreRow(lastSelection);
- $("#ndvjmst").editRow(rowid, true, null, null, null, null, null);
- lastSelection = rowid;
- }
- });
- $('#ndvjmst').navGrid('#pager_nd',
- {
- edit: true,
- add: true,
- del: true,
- search: false,
- refresh: false,
- view: false,
- position: "left",
- cloneToTop: false
- },
- {
- editCaption: "The Edit Dialog",
- recreateForm: true,
- checkOnUpdate: true,
- checkOnSubmit: true,
- closeAfterEdit: true,
- errorTextFormat: function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Add Dialog
- {
- closeAfterAdd: true,
- recreateForm: true,
- errorTextFormat: function(data) {
- return 'Error: ' + data.responseText
- }
- },
- // options for the Delete Dailog
- {
- errorTextFormat: function(data) {
- return 'Error: ' + data.responseText
- }
- });
- });
- </script>
- </body>
- </html>