Forum
22:43
28/05/2013
Hello.. I am new to this forum. I have downloaded jqgrid to retrieve some data from a SQL Server table and I have some troubles:
I have a simple grid that has 4 columns coming from the database: ID, Name, CreationDate, ModificationDate. All of those fields are shown, but only Name is editable. The ID and the dates are shown as plain text.
The problem I have is when a record is modified. Only Name field is passed to the server side. The CreationDate is sent as the default value as 01/01/0001 and not the value that currently has.
This is my script:
<script type="text/javascript">
$(function () {
$("#departamentos").jqGrid({
url: "@Url.Action("List")",
datatype: "json",
mtype: "GET",
colNames: ["@Html.DisplayNameFor(model => model.dep_id)",
"@Html.DisplayNameFor(model => model.dep_nombre)",
"@Html.DisplayNameFor(model => model.dep_creado_el)",
"@Html.DisplayNameFor(model => model.dep_modificado_el)",
" "],
colModel: [
{ name: "dep_id", index: "dep_id", key : true, sortable:false, editable:false, editoptions:{readonly:true,size:10}, width: 90 },
{ name: "dep_nombre", index: "dep_nombre", editable:true, width: 250 },
{ name: "dep_creado_el", index: "dep_creado_el", width: 100, align: "center", formatter: "date" },
{ name: "dep_modificado_el", index: "dep_modificado_el", width: 100, align: "center", formatter: "date" },
{ name: 'acciones', width: 58, fixed: true, sortable: false, resize: false, formatter: 'actions', formatoptions: { keys: true } }
],
jsonReader: {
repeatitems: false
},
pager: "#pager",
rowNum: 10,
rowList: [10, 20, 30],
sortname: "dep_nombre",
sortorder: "asc",
viewrecords: true,
gridview: true,
autoencode: true,
multiselect: true,
caption: "Departamentos",
editurl: "@Url.Action("AjaxEdit")",
});
$("#departamentos").jqGrid('navGrid', '#pager', { edit: true, add: true, del: true });
$.jgrid.edit.addCaption = "Agregar Departamento";
$.jgrid.edit.editCaption = "Modificar Departamento";
$.jgrid.edit.saveData = "¡El departamento fue modificado! ¿Almacena los cambios?";
$.jgrid.formatter.date.newformat = 'd-m-Y H:i';
});
</script>
Other problem is that, even when where is 11 records returned and only the first 10 are displayed, grid says that there is only 1 page.
Any help will be greatly appreciated
Thanks
Jaime
Most Users Ever Online: 715
Currently Online:
36 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66