Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Problem with dynamic combos in grid's column
22/04/2010
20:44
Avatar
Izaskun
Member
Members
Forum Posts: 6
Member Since:
29/03/2010
sp_UserOfflineSmall Offline

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

29/04/2010
11:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

03/05/2010
09:22
Avatar
Izaskun
Member
Members
Forum Posts: 6
Member Since:
29/03/2010
sp_UserOfflineSmall Offline

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


Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information