Selasa, 19 Januari 2016

JEASYUI : Combobox Jeasyui GetValue

 Saya menghadapi kendala ketika hendak menangkap nilai dari combobox jeasyui, intinya saya ingin ketika ada data yang update saya reload combobox nya, kemudian comboboxnya ter reload namun data yang dipilih terakhir tidak hilang, untuk percobaan pertama saya berhasil, namun ketika sudah ter reload, ternyata di view hasil onchange / onclick tidak menghasilkan combobox jeasyui namun hanya combobox biasa, nah supaya bisa menghasilkan rupa combobox yang sama akhirnya saya menambahkan sedikit script javascript yang dapat dilihat dibawah

 


View Utama 

<label id="resultzen"> 
            <div class="fitem">
                <label>Customer Type</label>
        
                <select name="m_CustType_ID" id="m_CustType_ID"  class="easyui-combobox" required="true"   >
                                                 <?
foreach ($custipe as $resulejs) {
?>
            <option value="<?= $resulejs['CustType_ID']; ?>"><?= $resulejs['Nama_CustType']; ?></option>
            <?php
}
?>
        </select>     
        
            </div>
            </label>


<script type='text/javascript'>

<script/> 

View Onclick, Onchange,etc 

    <div class="fitem">
                <label>Customer Type</label>
<select name="m_CustType_ID" id="m_CustType_ID"  >
           <option value="<?=$_POST['m_CustType_ID'];?>"><? foreach ($custipex as $resulejscvx) {  echo $resulejscvx['Nama_CustType'];  }?></option>
                                                 <?
foreach ($custipe as $resulejscv) {
?>
            <option value="<?= $resulejscv['CustType_ID']; ?>"><?= $resulejscv['Nama_CustType']; ?></option>
            <?php
}
?>
        </select>
</div>

    <script language="javascript" type="text/javascript">
   // This is run when the document has loaded.
   $(document).ready(function() {
      // Create a combobox
      $("#m_CustType_ID").combobox({
       
         selected: function(event, ui) {
            $("#m_CustType_ID").val($("#m_CustType_ID").val());
         }
      });
    
      $("#toggle").click(function() {
         $("#m_CustType_ID").toggle();
      });


   });
</script>
 

Tidak ada komentar:

Posting Komentar