EasyUI Forum
May 02, 2024, 06:05:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combogrid problemsql  (Read 15709 times)
naqib
Newbie
*
Posts: 7


View Profile Email
« 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
Logged
naqib
Newbie
*
Posts: 7


View Profile Email
« Reply #1 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
            });
         });            
         
Logged
dearsh
Newbie
*
Posts: 16

arif_yes06
View Profile Email
« Reply #2 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 -
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!