Advertisement
jamboljack

View Menu Tree

Sep 17th, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <div id="selection">
  2.     <ul>
  3.         <li data-jstree='{"icon" : "fa fa-building-o"}'>
  4.             <a href="<?php echo site_url('admin/penduduk/id/3320'); ?>">KABUPATEN JEPARA</a>
  5.         </li>
  6.         <?php
  7.         // Data Kecamatan
  8.         $listKecamatan = $this->penduduk_m->select_kecamatan()->result();
  9.         foreach($listKecamatan as $k) {
  10.         ?>
  11.         <li data-jstree='{"icon" : "fa fa-arrow-circle-o-right"}'>
  12.         <?php
  13.         $kecamatan_id = $k->kecamatan_id;
  14.         ?>
  15.             <a href="<?php echo site_url('admin/penduduk/kecamatan/'.$k->kecamatan_id); ?>"><?php echo 'KECAMATAN '.strtoupper($k->kecamatan_nama); ?></a>
  16.             <?php
  17.             // List Desa by Kecamatan          
  18.             $listDesa = $this->penduduk_m->select_desa($kecamatan_id)->result();
  19.             if (count($listDesa) > 0) {
  20.             ?>
  21.             <ul>
  22.                 <?php foreach($listDesa as $d) { ?>
  23.                 <li data-jstree='{"icon" : "fa fa-angle-right"}'>
  24.                     <a href="<?php echo site_url('admin/penduduk/desa/'.$d->desa_id); ?>"><?php echo 'DESA '.strtoupper($d->desa_nama); ?></a>
  25.                 </li>
  26.                 <?php } ?>
  27.             </ul>
  28.             <?php } ?>
  29.         </li>
  30.         <?php } ?>
  31.     </ul>
  32. </div>
  33.  
  34. <link rel="stylesheet" href="<?php echo base_url(); ?>backend/js/plugins/jstree/dist/themes/default/style.min.css" />
  35. <script type="text/javascript" src="<?php echo base_url(); ?>backend/js/plugins/jstree/dist/jstree.min.js"></script>
  36. <script>
  37. $(function () {
  38.     $("#selection").jstree({
  39.         "conditionalselect" : function (node, event) {
  40.             return false;
  41.         },
  42.         "plugins" : [ "conditionalselect" ]
  43.     });
  44. });
  45. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement