Forum


20:44

29/03/2010

Hi Tony,
I have a grid in which a column is a dynamic combo.
According to the [Image Can Not Be Found]selected register, the combo will have to carry different values.
I've implemented as follows:
if (jQuery.trim(tabla) && jQuery.trim(fila['tipoDato']) == tipoCombo){
var valorescombo = $.ajax({
url: 'v93PlantillaMatHomologadosInOP.do?action=findCombo&tabla='+tabla,
async: false,
success: function(data, result) {
if (!result)
alert('Failure to retrieve the Countries.');
}
}).responseText;
plantillaGrid.setColProp('select',{edittype:"select", display: true, hidden:false,
editoptions: {
value: valorescombo,
multiple:true
}
});
}
The problem I have is that once I loaded the combo with values, not charging me with others.
Let me explain:
The first record should have a combo with the values:
home
car
And the combo of the second record should have the values:
table
chair
If I select the first record see the combo loaded with:
home
car
But then I select the second record, although I receive are the values with which I have to upload (table, chair), I always carry the values of the first combo that I opened (home, car).
How could I fix it?
Thank you very much,
Izaskun
11:27

Moderators
30/10/2007

Hello,
I'm not sure that this is a bug. You should post your whole code or send a link to the problem.
There are a couple of post here regarding depended selects.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
09:22

29/03/2010

Hello Tony,
This is my code...
To create the grid I write:
plantillaGrid = $("#grid_plantilla").jqGrid({
url: "v93PlantillaMatHomologadosInOP.do?action=",
datatype: "json",
scroll: false,
rowNum:paginacionSize,
width: 800,
height: 'auto',
mtype: 'POST',
colNames: ['','',campo,valor,'1','2','3','4','5','6','7','8','9', '10'], //,'prueba'
colModel: [{name:'id',index:'1',width:100, hidden:true},//hidden:true, , editable:false //1
{name:'idPlantilla',index:'2', hidden:true},//hidden:true,, editable:false //2
{name:'campo',index:'3', width:100},//3, editable: true
{name:'valor',index:'4',width:100},//4,editable: true
{name:'tipoDato',index:'5', hidden:true},//5, hidden:true
{name:'decimales',index:'4', hidden:true},//6, hidden:true
{name:'longitud',index:'4', hidden:true},//7, hidden:true
{name:'tabla',index:'4', hidden:true},//8, hidden:true
{name:'multiple',index:'4', hidden:true},//9, hidden:true
{name:'oblig',index:'4', hidden:true},//10, hidden:true
{name:'select',index:'4', width:100, hidden:true},//11 , edittype:"select", hidden:true,editable: true,
{name:'codigosCombo', hidden:true},//12, editable: true, hidden:true
{name:'check',index:'4', edittype:"checkbox", hidden:true},//, editable: true, hidden:true
{name:'restoCampos',index:'4', hidden:true} // editable: true
],
viewrecords: true,
imgpath: jsPath,
pager: $("#pager_grid_plantilla"),
cellsubmit: 'clientArray',
editurl:'http://localhost/v93War/v93MantenimientosJSP/materialesHomologados/vacia.jsp',
ondblClickRow: function(id){
if (modoVer == false){
editarFilaPlantilla();
}
}
});
jQuery("#grid_plantilla").jqGrid('navGrid','#pager_grid_plantilla',{edit:false,add:false,del:false,search:false,refresh:false,size:50});
}
To complete the different combos depends the row I select I do this:
function editarFilaPlantilla(){
var numFila = plantillaGrid.getGridParam('selrow');
//var filaSeleccionada = $("#grid_plantilla").jqGrid('getGridParam','selrow');
if( numFila != null ){
var fila = plantillaGrid.getRowData(numFila);
//Comprobamos si el campo es obligatorio
var obligatorio = false;
if (jQuery.trim(fila['oblig']) == 1){
obligatorio = true;
}
//Si se trata de una combo hay que rellenarla con los datos de la tabla
var tabla = fila['tabla'];
if (jQuery.trim(tabla) && jQuery.trim(fila['tipoDato']) == tipoCombo){
var valorescombo = $.ajax({
url: 'v93PlantillaMatHomologadosInOP.do?action=findCombo&tabla='+tabla,
async: false,
success: function(data, result) {
if (!result)
alert('Failure to retrieve the Countries.');
}
}).responseText;
plantillaGrid.setColProp('select', {edittype:"select", display: true, hidden:false,
editoptions: {
value: valorescombo,
multiple:true
}
});
}
valorescombo: is the variable I use to recuperate the values of the different combos. Debugging the code I have found that the variable is updated correctly, but when I assign the value of "valorescombo" to the combo it only populate all right the first time, following times it gets the values of the first time, although "valorescombo" is different.
Thank you very much,
Izaskun
Most Users Ever Online: 715
Currently Online:
39 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