Skip to content

Instantly share code, notes, and snippets.

@xola139
Created August 22, 2014 18:02
Show Gist options
  • Save xola139/5a6524bdde908c490271 to your computer and use it in GitHub Desktop.
Save xola139/5a6524bdde908c490271 to your computer and use it in GitHub Desktop.
Si tengo este jqgrid
function dibujaGrid(idTabla, myControls, colNamesParam, colModelParam,
captionTitle, Width, Height, Filtro, Footer) {
// Grid para los eventos
jQuery("#" + idTabla).jqGrid({
datatype : "json",
scroll : true,
loadtext : 'Cargando...',
colNames : colNamesParam,
colModel : colModelParam,
width : Width,
height : Height,
footerrow : Footer,
shrinkToFit : true,
hiddengrid : false,
hidegrid:false,
viewrecords : true,
rowNum : 1000,
caption : captionTitle,
autowidth: true
});
}
jQuery(document).ready(function(){
var myControls = new Array('id','empresa','TotalRecibidos');
var colNameParams = ['Name ID','Name Empresa','Name Total'];
var colModelParam = [
{name:myControls[0],width: 360,sortable:false},
{name:myControls[1],width: 83,sortable:false},
{name:myControls[2],width: '100%',sortable:false,align:'center'}
];
dibujaGrid("bloque1", myControls, colNameParams, colModelParam, "",544,220,false,false);
});
//Puedo agrarel row con esto
$("#bloque1").jqGrid('addRowData', i, {id:'',empresa:'',TotalRecibidos:''}, "first");
/*Donde i= Identificador del row
lo que esta en {id:'',empresa:'',TotalRecibidos:''} es la información que se quiere colocar en el row
y "first" es la ubicación si se quiere colocar después o primer renglón
*/
//De la misma forma para Update
$("#bloque1").jqGrid('setRowData', i,{id:'',empresa:'',TotalRecibidos:''});
Donde i= Identificador del row y
{id:'',empresa:'',TotalRecibidos:''} es la información que se quiere actualizar en el row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment