Berikut contoh scriptnya langsung cekiprot
Tabel Grid
<script type='text/javascript'>
$(function() {
var datanya = <?php echo json_encode($_POST); ?>;
var type = '<?=$TANDA; ?>';
$("#resultcustype").datagrid({
//url : $.post('<?= site_url() ?>/tiket/searchresultcustype/',datanya,'success'),
url : '<?= site_url() ?>/masterp/searchresultcustype/type/'+type,
method : 'POST',
queryParams: datanya,
columns:[[
{field:'KD_CustType',title:'KD_CustType',sortable:true},
{field:'Nama_CustType',title:'Nama_CustType',sortable:true},
{field:'IsAktifCustType',title:'IsAktif',formatter:formatPrice}
]],
showHeader:"true",
toolbar:"#toolbarcustype",
pagination:"true",
nowrap: "false",
pageSize: 10,
fitcolumns: "true",
rownumbers: "false",
singleSelect: "true"
})
});
</script>
Script untuk membuat checkbox nya
<script>
function formatPrice(val,row){
if (val > 0){
return '<input type="checkbox" checked>';
} else {
return '<input type="checkbox" >';
}
}
</script>
Tidak ada komentar:
Posting Komentar