Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Assalamu alaikum.. Edit javascript data tidak bisa tampil di form ..
Pertanyaan : Pada waktu klik edit pada record yg dimaksud .. Form bisa tampil tapi Data tidak bisa tampil . ini source codenya :
New Type Edit Type Remove Type
Type Information
Kode Type:
Nama Type :
Jenis :
Mohon bantuannya Terimakasih ...Kode TypeNama TypeJenis
4 Jawaban:
tolong kodingnya dimasukan kedalam <pre> </pre> dan perbaiki indentasinya agar kami mudah membaca koding yang kaka buat :)
kodingnya dimasukan dalam [code] ['slash'code]
<pre><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="jquery,ui,easy,easyui,web"> <meta name="description" content="easyui help you build your web page easily!"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/demo.css"> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script> </head> <body> <table id="dg" title="My Type" class="easyui-datagrid" style="width:550px;height:450px" url="../pagetype/get_type.php" toolbar="#toolbar" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th data-options="field:'kodetype',width:80">Kode Type</th> <th data-options="field:'namatype',width:300">Nama Type</th> <th data-options="field:'jenis',width:50">Jenis</th> </tr> </thead> <div id="toolbar"> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newType()">New Type</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editType()">Edit Type</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyType()">Remove Type</a> </div> <div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px" closed="true" buttons="#dlg-buttons"> <div class="ftitle">Type Information</div> <form id="fm" method="post" novalidate> <div class="fitem"> <label>Kode Type:</label> <input name="kodetype" class="easyui-textbox" required="true"> </div> <div class="fitem"> <label>Nama Type :</label> <input name="namatype" class="easyui-textbox" required="true"> </div> <div class="fitem"> <label>Jenis :</label> <input name="jenis" class="easyui-textbox"> </div> </form> </div> <div id="dlg-buttons"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveType()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a> </div> <script type="text/javascript"> var url; function newType(){ $('#dlg').dialog('open').dialog('setTitle','New Type'); $('#fm').form('clear'); url = '../pagetype/save_type.php'; } function editType(){ var row = $('#dg').datagrid('getSelected'); if (row){ $('#dlg').dialog('open').dialog('setTitle','Edit Type'); $('#fm').form('load',row); $('#kodetype').attr('readonly','readonly'); url = '../pagetype/update_type.php?id='+row.id; } } function saveType(){ $('#fm').form('submit',{ url: url, onSubmit: function(){ return $(this).form('validate'); }, success: function(result){ var result = eval('('+result+')'); if (result.errorMsg){ $.messager.show({ title: 'Error', msg: result.errorMsg }); } else { $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); // reload the type data } } }); } function destroyType(){ var row = $('#dg').datagrid('getSelected'); if (row){ $.messager.confirm('Confirm','Are you sure you want to destroy this Type?',function(r){ if (r){ $.post('../pagetype/destroy_type.php',{id:row.id},function(result){ if (result.success){ $('#dg').datagrid('reload'); // reload the type data } else { $.messager.show({ // show error message title: 'Error', msg: result.errorMsg }); } },'json'); } }); } } </script> <style type="text/css"> #fm{ margin:0; padding:10px 30px; } .ftitle{ font-size:14px; font-weight:bold; padding:5px 0; margin-bottom:10px; border-bottom:1px solid #ccc; } .fitem{ margin-bottom:5px; } .fitem label{ display:inline-block; width:80px; } .fitem input{ width:160px; } </style> </body> </html> </pre>