Edición de «Msjqgrid»
De KumbiaPHP Framework Wiki
Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces guarda los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 2: | Línea 2: | ||
= Helper = | = Helper = | ||
− | |||
<?php | <?php | ||
/** | /** | ||
Línea 140: | Línea 139: | ||
} | } | ||
?> | ?> | ||
− | + | ||
= parcial = | = parcial = | ||
− | + | ||
<?php echo Tag::css('jqGrid-4.1.1/css/ui.jqgrid'); ?> | <?php echo Tag::css('jqGrid-4.1.1/css/ui.jqgrid'); ?> | ||
<?php echo Tag::css('jqGrid-4.1.1/css/ui.multiselect'); ?> | <?php echo Tag::css('jqGrid-4.1.1/css/ui.multiselect'); ?> | ||
Línea 249: | Línea 248: | ||
position:"last" | position:"last" | ||
}); | }); | ||
− | |||
jQuery("#list").jqGrid('navButtonAdd',"#pagered",{ | jQuery("#list").jqGrid('navButtonAdd',"#pagered",{ | ||
caption:"", | caption:"", | ||
Línea 269: | Línea 267: | ||
position:"last" | position:"last" | ||
}); | }); | ||
+ | |||
+ | |||
}); | }); | ||
− | function mysum(val, name, record){ | + | |
− | + | ||
+ | function mysum(val, name, record) | ||
+ | { return parseFloat(val||0) + parseFloat((record[name]||0)); | ||
} | } | ||
− | function currencyFmatter (cellvalue, options, rowObject){ | + | function currencyFmatter (cellvalue, options, rowObject) |
+ | { | ||
return "$"+cellvalue; | return "$"+cellvalue; | ||
}; | }; | ||
// $("#list").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } ); | // $("#list").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } ); | ||
− | |||
function formatOperations(cellvalue, options, rowObject) { | function formatOperations(cellvalue, options, rowObject) { | ||
return "<a href='/<?php echo $dataGrid->url ?>edit/" + cellvalue + "' id='ui-icon-trash'><u>Edit</u></a> "+ | return "<a href='/<?php echo $dataGrid->url ?>edit/" + cellvalue + "' id='ui-icon-trash'><u>Edit</u></a> "+ | ||
"<a <a href='/<?php echo $dataGrid->headers ?>del/" + cellvalue + "'><u>Edit</u></a>"; | "<a <a href='/<?php echo $dataGrid->headers ?>del/" + cellvalue + "'><u>Edit</u></a>"; | ||
− | }; | + | }; |
Línea 296: | Línea 298: | ||
<div id="pagered" style="height: 40px"></div> | <div id="pagered" style="height: 40px"></div> | ||
</div> | </div> | ||
− | + | ||
= Vista = | = Vista = | ||
− | |||
− | |||
− | + | <?php View::content()?> | |
− | + | <?php $dataGrid = new msjqgrid($listArticulos); ?> | |
− | + | <?php $dataGrid->fields = array('id' => 'id','codigo' => 'codigo', 'denominacion' => 'denominacion', 'stock' => 'stock', 'precio' => 'precio');?> | |
− | + | <?php //$dataGrid->headers = array('id' => 'ID','codigo' => 'CODIGO', 'denominacion' => 'DESCRIPCION', 'stock' => 'STOCK', 'precio' => 'PRECIO');?> | |
− | + | <?php //$dataGrid->typefields = array('id' => 'integer','codigo' => 'string', 'denominacion' => 'string', 'stock' => 'STOCK', 'precio' => 'PRECIO');?> | |
− | + | <?php $dataGrid->setFormatOption('precio',',formatter:"currency",formatoptions:{decimalSeparator:",", thousandsSeparator: ",", decimalPlaces: 2, prefix: "$ "}');?> | |
− | + | <?php $dataGrid->setkey('id',',key:true');?> | |
− | + | <?php echo View::partial('msjqgrid/msjqgrid' ,false,array('dataGrid'=>$dataGrid)); ?> | |
− | |||
− | |||
− |