Show Posts
|
Pages: 1 2 [3] 4
|
41
|
General Category / EasyUI for jQuery / Re: Problem Filter Mode Remote on Combogrid
|
on: August 17, 2013, 09:16:30 AM
|
Try the following: index.php <html> <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/demo/demo.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script> $(function(){ $('#cg').combogrid({ panelWidth:500, url:'get_data_tabel.php', idField:'id', textField:'uraian', mode:'remote', striped: true, editable:true, collapsible:false, rownumbers:true, fit:true, fitColumns:true, pagination:true, pageSize: 10, pageList: [10], columns:[[ {field:'id',title:'Id',width:5,hidden:true}, {field:'uraian',title:'Uraian',width:10}, {field:'keterangan',title:'Keterangan',widht:60}, {field:'active',title:'Status',width:10} ]] }); }); </script> <body> <h2> Filter in Combogrid </h1> <input id="cg" style="width:150px"></input> </body> </html>
get_data_tabel.php <?php include 'config.php'; $q = isset($_POST['q']) ? strval($_POST['q']) : ''; $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; $offset = ($page-1)*$rows; $result = array(); //$where = "uraian like '%a%' or keterangan like '%a%'"; //$rs = mysql_query("select count(*) from tb_referensi where ".$where); $rs = mysql_query("select count(*) from tb_referensi where uraian like '%$q%' or keterangan like '%$q%' "); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; $rs = mysql_query("select * from tb_referensi where uraian like '%$q%' or keterangan like '%$q%' limit $offset,$rows "); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } $result["rows"] = $items;
echo json_encode($result); ?>
config.php <?php
$conn = @mysql_connect('127.0.0.1','root',''); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db('mydb', $conn);
?>
|
|
|
44
|
General Category / EasyUI for jQuery / Re: Problem Filter Mode Remote on Combogrid
|
on: August 16, 2013, 09:34:03 AM
|
Your code works fine as i tested it. I'm not sure if it was a problems from typo or somethings else. 3. File config.php <?php
$conn = @mysql_connect('127.0.0.1','root','','9090'); <- 9090 should be named as "tb_referensi". if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db('gammu', $conn);
?>
|
|
|
45
|
General Category / EasyUI for jQuery / Re: decode html entity in combobox
|
on: August 03, 2013, 09:40:06 AM
|
<select class="easyui-combobox" name="state" style="width:200px;"> <option value="AL">Alabam&a</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> </select>
When i choose "Alabam&a", i want it to show as "Alabam&a".
|
|
|
|