Skip to content

Instantly share code, notes, and snippets.

@haifahrul
Created August 23, 2019 03:40
Show Gist options
  • Save haifahrul/1de3a235dedb9d1bd29df20ebc7028ee to your computer and use it in GitHub Desktop.
Save haifahrul/1de3a235dedb9d1bd29df20ebc7028ee to your computer and use it in GitHub Desktop.
Yii2 Grid Jeasyui - View
<table id="dg" class="" toolbar="#dg-toolbar">
<thead data-options="frozen:true">
<th field="ktp" sortable="true" fixed="true" width="120">KTP</th>
<th field="people_name" sortable="true" fixed="true" width="180">Name</th>
<th field="people_gender" sortable="true" fixed="true" width="80" align="center">Gender</th>
</thead>
<thead>
<tr>
<th field="ktp" sortable="true" fixed="true" width="120">KTP</th>
<th field="people_name" sortable="true" fixed="true" width="180">Name</th>
<th field="people_gender" sortable="true" fixed="true" width="80" align="center">Gender</th>
<th field="phone" sortable="true" fixed="true" width="100">Phone</th>
<th field="state" sortable="true" fixed="true" width="130">State</th>
<th field="city" sortable="true" fixed="true" width="130">City</th>
<th field="address" sortable="true" fixed="true" width="190">Address</th>
<th field="zip_code" sortable="true" fixed="true" width="100">Zip Code</th>
<th field="is_internal" sortable="true" fixed="true" width="100" align="center" formatter="libs.functions.formatStatus">Status</th>
<th field="unit_name" sortable="true" fixed="true" width="180">Unit Name</th>
</tr>
</thead>
</table>
<?php
$script = <<<SCRIPT
$('#dg').datagrid({
fit: true,
singleSelect: true,
// fitColumns:true,
pageList: [10,15,20,50,100],
rownumbers: true,
pageSize: 20,
url: URL, // ganti url get data
pagination: true,
});
SCRIPT;
$this->registerJs($script, \yii\web\View::POS_READY);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment