jqGrid: datos POST al servidor para obtener datos de fila (filtrado y búsqueda)
Tengo un formulario como este:
<form id='myForm'>
<input type='text' name='search' />
<input type='text' name='maxPrice' />
</form>
y tabla para mi jqGrid:
<table id='myGrid'></table>
Necesito PUBLICAR (no OBTENER) los datos demyForm
a mi método de servidor para obtener los datos de la fila y llenar la cuadrícula. Hasta ahora, no he podido hacer que jqGrid publique nada. Verifiqué dos veces mi serialización de datos y está serializando mis datos de formulario correctamente. Aquí está mi código jqGrid:
$("#myGrid").jqGrid({
url: '/Products/Search") %>',
postData: $("#myForm").serialize(),
datatype: "json",
mtype: 'POST',
colNames: ['Product Name', 'Price', 'Weight'],
colModel: [
{ name: 'ProductName', index: 'ProductName', width: 100, align: 'left' },
{ name: 'Price', index: 'Price', width: 50, align: 'left' },
{ name: 'Weight', index: 'Weight', width: 50, align: 'left' }
],
rowNum: 20,
rowList: [10, 20, 30],
imgpath: gridimgpath,
height: 'auto',
width: '700',
//pager: $('#pager'),
sortname: 'ProductName',
viewrecords: true,
sortorder: "desc",
caption: "Products",
ajaxGridOptions: { contentType: "application/json" },
headertitles: true,
sortable: true,
jsonReader: {
repeatitems: false,
root: function(obj) { return obj.Items; },
page: function(obj) { return obj.CurrentPage; },
total: function(obj) { return obj.TotalPages; },
records: function(obj) { return obj.ItemCount; },
id: "ProductId"
}
});
¿Puedes ver lo que estoy haciendo mal o debería hacerlo de manera diferente?