I have the following table declaration:
$("#lotesAsignados").jqGrid({
datatype: "local",
height: 200,
colNames: ["LOTE","recepcionId","FECHA REC.","P. BRUTO","TIPO MAT.","PESADA VACIADA","CARGUIO MAQUINA","EMBOLSADA ARRUMADA","SOLO COMUNEADA","SOLO VACIADA","SOLO PESADA","SOLO EMBOLSADA","COSTO MANIPULEO"],
colModel:[ {name:'lote',index:'lote', width:70},
{name:'recepcionId',index:'recepcionId', width:5, hidden: true},
{name:'fechaDeRecepcion',index:'fechaDeRecepcion', width:70},
{name:'pesoBruto',index:'pesoBruto', width:60},
{name:'tipoDeMaterial',index:'tipoDeMaterial', width:80},
{name:'pesadaVaciada',index:'pesadaVaciada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'carguioMaquina',index:'carguioMaquina', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'embolsadaArrumada',index:'embolsadaArrumada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'soloComuneada',index:'soloComuneada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'soloVaciada',index:'soloVaciada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'soloPesada',index:'soloPesada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'soloEmbolsada',index:'soloEmbolsada', width:70, edittype:"checkbox",editoptions: {value:"Si:No"},editable: true,formatter: "checkbox", formatoptions: {disabled : false} },
{name:'costoManipuleo',index:'costoManipuleo', width:80} ],
onSelectRow: function(id){
},
multiselect: false,
caption: "LOTES A PAGAR"
});
There are some hidden fields in my view to contain parameters to make a calculation according to the formula:
costoManipuleo = pesadaVaciada + carguioMaquina + embolsadaArrumada + soloComuneada + soloVaciada + soloPesada + soloEmbolsada
Given the values (just and example):
pesadaVaciada = 10
carguioMaquina = 15
embolsadaArrumada = 10
soloComuneada = 5
soloVaciada = 10
soloPesada = 20
soloEmbolsada = 10
For LOTE: PX-CM070199, if pesadaVaciada
, soloComuneada
and soloEmbolsada
checkboxes are selected then costoManipuleo
cell must contain 25
.
For LOTE: PX-CM070200, if all checkboxes are selected then costoManipuleo
cell must contain 70
.
I've tried modifying this and this solutions to my needs but I'm clueless. I don't know how to identify which checkbox was clicked and it gets harder for me when I see that the rendered HTML code for a checkbox is something like this:
<input value="no" offval="no" type="checkbox">