Title: combogrid problemsql Post by: naqib on May 29, 2012, 03:28:13 AM Hello everyone,
I just heard about easyui and I have a combogrid which fetches record from mysql. at the same time with same code I want to post a value of another textbox so that I can add it n SQL Statement: $q = isset($_POST['q']) ? strval($_POST['q']) : ''; $vv = $_GET['vv']; include 'conn.php'; $rs = mysql_query("select * from client where client_id like '%$q%' AND companyid = $vv"); thanks for your help in advance Title: Re: combogrid problemsql Post by: naqib on May 29, 2012, 05:35:38 AM I did solve it as:
php code: $q = isset($_POST['q']) ? strval($_POST['q']) : ''; $vv = $_GET['vv']; include 'conn.php'; // this sub query returns a companyid which is equal to the value taken from $_GET $rs = mysql_query("select * from client where client_id like '%$q%' AND companyid = (SELECT companyid FROM companylist WHERE company = substr('$vv',1,3))"); $rows = array(); while($row = mysql_fetch_assoc($rs)){ $rows[] = $row; } echo json_encode($rows); Javascript: I put the following code inside the textbox focusout event: var cbv = $("#cqccompany").val(); $('#ccode').combogrid({ panelWidth:500, url: 'form5_getdata.php?vv='+ cbv, idField:'client_id', textField:'client_id', mode:'remote', fitColumns:true, columns:[[ {field:'client_id',title:'Client ID',width:60}, {field:'client_code',title:'Client Code',align:'right',width:80}, {field:'client_name',title:'Client Name',align:'right',width:60}, {field:'address',title:'Address',align:'right',width:60}, {field:'telephone',title:'Telephone',width:150}, {field:'fax',title:'Fax',align:'center',width:60} ]] }); $("input[name='mode']").change(function(){ var mode = $(this).val(); $('#ccode').combogrid({ mode: mode }); }); Title: Re: combogrid problemsql Post by: dearsh on August 11, 2013, 01:47:35 AM $("input[name='mode']").change(function(){
var mode = $(this).val(); $('#ccode').combogrid({ mode: mode }); }); what purpose that code ? Best regard - dearsh - |