EasyUI Forum
May 21, 2024, 01:27:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / General Discussion / Re: get data from detail grid on: June 18, 2012, 04:40:16 AM
I did solve it like this:

      $(function(){
         $('#dg').datagrid({
            view: detailview,
            detailFormatter:function(index,row){
               return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
            },
            onExpandRow: function(index,row)
            {
               $('#ddv-'+index).datagrid(
               {
                  url:'<?php echo ROOT_WEB ?>model/searchStandard.php?product_code='+row.product_code,
                  fitColumns:true,
                  singleSelect:true,
                  height:'auto',
                  columns:[[
                     {field:'product_code',title:'Product Code',width:60},
                     {field:'commitee',title:'Commitee',width:200},
                     {field:'stand_title',title:'Standard',width:60},
                     {field:'stand_link',title:'Standard File',width:60},
                     {field:'description',title:'Description',width:60},
                     {field:'stand_no',title:'Standard No',width:60}
                  ]],
                  onResize:function()
                  {
                     $('#dg').datagrid('fixDetailRowHeight',index);
                  },
                  onLoadSuccess:function()
                  {
                     setTimeout(function(){
                        $('#dg').datagrid('fixDetailRowHeight',index);
                     },0);
                  },
                  onSelect: function() {
                     getSelected(index);
                  }
               });
               $('#dg').datagrid('fixDetailRowHeight',index);
            }
            });
      });

   function getSelected(index){
         var row = $('#dg').datagrid('getRows');
         var drow = $('#ddv-'+index).datagrid('getSelected');      
         setValue(drow);
      }
   function getDelete() {
      $.messager.alert('Info', 'Deletion failed!', 'info');
   }
   function setValue(drow) {
      $('#cstand_pcode').val(drow.product_code);
      $('#cstand_commitee').append('<option selected>' + drow.commitee + '</option>');
      $('#cstand_name').val(drow.stand_no);
      window.top.document.getElementById("footer").src = "<?php echo ROOT_WEB ?>public/files/standUpload/"+drow.stand_link;
   }


Thanks for your help
2  General Category / General Discussion / Re: get data from detail grid on: June 14, 2012, 06:24:37 AM
Thanks for replay:
I replaced the code, now I get no alert message when I press on parent record, however, when I collapse the row and select one of detail row
and come back and click on parent row it gives me:

[object Object],[object Object],[object Object]

in alert box! Sad

please help me I very new
3  General Category / General Discussion / Re: get data from detail grid on: June 14, 2012, 01:24:12 AM
When I saw the code you provided to me I thought It will work, but once again no hope, please see my code may be I have did some other mistake:

$('#dg').datagrid({
            view: detailview,
            detailFormatter:function(index,row){
               return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
            },
            onExpandRow: function(index,row){
               $('#ddv-'+index).datagrid({
                  url:'<?php echo ROOT_WEB ?>model/searchStandard.php?product_code='+row.product_code,
                  fitColumns:true,
                  singleSelect:true,
                  height:'auto',
                  columns:[[
                     {field:'product_code',title:'Product Code',width:60},
                     {field:'commitee',title:'Commitee',width:200},
                     {field:'stand_title',title:'Standard',width:60},
                     {field:'stand_link',title:'Standard File',width:60},
                     {field:'description',title:'Description',width:60}
                  ]],
                  onResize:function(){
                     $('#dg').datagrid('fixDetailRowHeight',index);
                  },
                  onLoadSuccess:function(){
                     setTimeout(function(){
                        $('#dg').datagrid('fixDetailRowHeight',index);
                     },0);
                  },
                   onClickRow: function(rowIndex){
                     var detailContainer = $(this).datagrid('getRowDetail', rowIndex);
                     if (detailContainer.find('div.datagrid').length){  // the detail datagrid has been created
                     var ddv = $('#ddv-'+rowIndex);  // the detail datagrid object
                     var rows = ddv.datagrid('getRows');  // get the detail datagrid rows
                     alert(rows);
                     }
                  }
               });
               $('#dg').datagrid('fixDetailRowHeight',index);
            }
         });

4  General Category / General Discussion / Re: get data from detail grid on: June 13, 2012, 12:30:20 AM
thanks for reply,
I did add this code it does not work, for test purpose I checked it is not printing the rows data in alert
    onClickRow: function(rowData,rowIndex)
                  {
                     var ddv = $('#ddv-'+rowIndex);  // the detail datagrid object
                     var rows = ddv.datagrid('getRows');  // get the detail datagrid rows
                     alert(rows + "  " + rowData);
                  }

any idea?
5  General Category / General Discussion / get data from detail grid on: June 08, 2012, 02:17:12 AM
Hello everyone:
I want to get the selected row data and insert it into my form which I have done, however, I want to get the detail data as well with the same click to store it in my next form my code is:

      $('#dg').datagrid({
            view: detailview,
            detailFormatter:function(index,row){
               return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
            },
            onExpandRow: function(index,row){
               $('#ddv-'+index).datagrid({
                  url:'<?php echo ROOT_WEB ?>model/searchProductDetail.php?product_code='+row.product_code,
                  fitColumns:true,
                  singleSelect:true,
                  height:'auto',
                  columns:[[
                     {field:'draw_name',title:'Drawing',width:60},
                     {field:'description',title:'Description',width:200},
                     {field:'draw_link',title:'File',width:60}
                  ]],
                  onResize:function(){
                     $('#dg').datagrid('fixDetailRowHeight',index);
                  },
                  onLoadSuccess:function(){
                     setTimeout(function(){
                        $('#dg').datagrid('fixDetailRowHeight',index);
                     },0);
                  }
               });
               $('#dg').datagrid('fixDetailRowHeight',index);
            },
            onClickRow: function(rowData, rowIndex) {
               var row = $('#dg').datagrid('getSelected');  
                
                if (row){  
                    $('#productcode').val(row.product_code);
                    $('#productname').val(row.product_name);
                    $('#clientpartno').val(row.client_partno);
                    $('#revision').val(row.revision);
                    $('#description').val(row.description);
                    $('.combo input').val(row.client_id);
                }  
             }
6  General Category / General Discussion / Re: combogrid problemsql 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
            });
         });            
         
7  General Category / General Discussion / combogrid problemsql 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
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!