Código:
pero la función jQuery("#listadoGrid").setColProp('SelectPuertas', {editoptions:{value:select}}); que se supone me debería introducir los valores del select no hace nada. Podría alguien echarme un cable? Muchas gracias, un saludo <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><s:text name="titleWindowGate" /></title> <link href="../../web/css/ui-lightness/jquery-ui-1.8.12.custom.css" rel="stylesheet" type="text/css" /> <link href="../../web/css/ui-lightness/ui.jqgrid.css" rel="stylesheet" type="text/css" /> <link href="../../web/css/ui-lightness/ui.multiselect.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<s:url value="/js/jquery-1.4.2.min.js"/>"></script> <script type="text/javascript" src="<s:url value="/js/jquery-ui-1.8.12.custom.min.js"/>"></script> <script type="text/javascript" src="<s:url value="/js/jquery.layout.js"/>" ></script> <script type="text/javascript" src="<s:url value="/js/grid.locale-en.js"/>" ></script> <script type="text/javascript" src="<s:url value="/js/ui.multiselect.js"/>"></script> <script type="text/javascript" src="<s:url value="/js/jquery.jqGrid.min.js"/>"></script> <script type="text/javascript" src="<s:url value="/js/jquery.tablednd.min.js"/>"></script> <script type="text/javascript" src="<s:url value="/js/jquery.contextmenu.js"/>"></script> <link href="../../web/css/login.css" rel="stylesheet" type="text/css" /> <link href="../../web/css/dropdown/dropdown.css" media="all" rel="stylesheet" type="text/css" /> <link href="../../web/css/dropdown/themes/default/default.ultimate.css" media="all" rel="stylesheet" type="text/css" /> <link href="../../web/css/Clistados.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function() { //buscandoErrores(); listarPuertas(); }); var listOfTypeGate = new Array(); <s:iterator value="gateTypeList"> listOfTypeGate.push({id: <s:property value="idGateType"/>, value: '<s:property value="name"/>'}); </s:iterator> var listOfZoneGate = new Array(); <s:iterator value="zoneGateList"> listOfZoneGate.push({id: <s:property value="idZoneGate"/>, value: '<s:property value="name"/>'}); </s:iterator> var listOfStands = new Array(); <s:iterator value="standList"> listOfStands.push({id: '<s:property value="idStand"/>', value: '<s:property value="standCode"/>'}); </s:iterator> function buscandoErrores() { alert('hola'); jQuery.ajax({ type: 'GET', cache: false, url:'/AODB2/maintenance/gate/NewGate.action?accion=listar&numItemsPerPage='+numItemsPerPage+'&selectedPage='+paginaSeleccionada, dataType: "json", success: function (json, textstatus) { alert(json.rows[0].id + ''+json.rows[0].cell +json.rows[1].id + ''+json.rows[1].cell); $('#listadoGrid').replaceWith( '<div id="listadoGrid">\n' + json + '</div>' ); }, error: function (xhr, textEstatus, errorThrown) { alert(xhr); alert(textEstatus); alert(errorThrown); } }); } var numItemsPerPage = '<s:property value="%{numItemsPerPage}"/>'; var paginaSeleccionada = '<s:property value="%{selectedPage}"/>'; function listarPuertas() { jQuery("#listadoGrid").jqGrid({ url:'/AODB2/maintenance/gate/NewGate.action?accion=listar&numItemsPerPage='+numItemsPerPage+'&selectedPage='+paginaSeleccionada, datatype: "json", colNames:['Codigo','Nombre', 'Descripcion', 'SelectPuertas','Tipo de Puerta','Zona','Stand'], colModel:[ {name:'idGate',index:'idGate', width:110, align:'center', editable:true, editoptions:{size:10},editrules:{required:true}}, {name:'name',index:'name', width:160, align:'center', editable:true, editoptions:{size:10},editrules:{required:true}}, {name:'description',index:'description', width:200, align:'center', editable:true}, {name:'selectGateType', index: 'selectGateType',width:200, editable: true, edittype:"select"}, {name:'nameGateType',index:'nameGateType', width:120, align:'center',editable:true}, {name:'Zona',index:'Zona',width:110,align:'center', editable:true}, {name:'idStand',index:'idStand', width:120, align:'center', editable:true} ], rowNum:2, rowList:[2,4,8], pager: '#pageGrid', sortname: 'Nombre', viewrecords: true, sortorder: "desc", jsonReader: { root: "rows", repeatitems : false, page: "page", total: "total", records: "records", id: "0" }, editurl: '/AODB2/maintenance/gate/GateInsert.action?', caption: "Puertas", height: '100%' }); jQuery("#listadoGrid").jqGrid('navGrid','#pageGrid', { view: true }, //options { top: 500, left: 100, height:300, width:500, beforeShowForm: function(){ var ids = jQuery("#listadoGrid").jqGrid('getDataIDs');//selecciona los ids var idSel = jQuery("#listadoGrid").jqGrid('getGridParam','selrow'); //idseleccionado var select = ''; for (i=0; i < listOfTypeGate.length; i++) { select = select +listOfTypeGate[i].id+':'+listOfTypeGate[i].value; if (i < listOfTypeGate.length -1) { select = select + ";"; } } select = '"'+select+'"'; alert(select); jQuery("#listadoGrid").setColProp('SelectPuertas',{editoptions:{value:select}}); //jQuery("#listadoGrid").jqGrid('showCol','SelectPuertas'); }, onclickSubmit: function(){ var ids = jQuery("#listadoGrid").jqGrid('getDataIDs');//selecciona los ids var idSel = jQuery("#listadoGrid").jqGrid('getGridParam','selrow'); //idseleccionado var fila = jQuery("#listadoGrid").getRowData(idSel); //selecciona la fila que se introdujo, no con los cambios hechos en formulario alert(fila.idGate+', '+fila.name+', '+fila.description+', '+fila.selectGateType+', '+fila.nameGateType+', '+fila.Zona+', '+fila.idStand); //var nombree = jQuery("#listadoGrid").getCell(idSel, 1); }, closeAfterEdit: true, reloadAfterSubmit:true }, // edit options {height:280,reloadAfterSubmit:false}, // add options {reloadAfterSubmit:false}, // del options {} // search options ); paginaSeleccionada = jQuery("#listadoGrid").getGridParam("page"); //alert(paginaSeleccionada); } </script> </head> <body> <!--<h2><s:text name="titleGate"/></h2>--> <div id="contenedor"> <div id="cabecera"> <!--<div id="logo"><h2>AODB</h2></div>--> <s:include value ="../../../application/menu.jsp"/> </div> <div id="info"></div> <div id="banner"></div> <table id="listadoGrid"></table> <div id="pageGrid"></div> <div id="pie" align="center"><s:actionerror /><s:fielderror /></div> </div> </body> </html>