EasyUI Forum
October 18, 2025, 06:41:03 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: pass id from datagrid to datagrid under dialog box  (Read 12528 times)
john17
Newbie
*
Posts: 17


View Profile Email
« on: July 20, 2014, 06:22:46 PM »

hi guys,

how can i pass the id of the select row in datagrid to another datagrid under/inside the edit dialog box?
here is my reference : http://www.jeasyui.com/tutorial/app/crud.php

thanks Grin Grin Grin
« Last Edit: July 20, 2014, 11:01:51 PM by john17 » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 21, 2014, 12:02:39 AM »

Call 'getSelected' method of datagrid to get the selected row data. You can call 'reload' method to reload another datagrid by passing the selected id value of the first datagrid. Please refer to the code below:
Code:
var row = $('#dg1').datagrid('getSelected');
if (row){
  var id = row.id;  // get the row id
  $('#dg2').datagrid('reload', {id:id});
  // ...
}
Logged
john17
Newbie
*
Posts: 17


View Profile Email
« Reply #2 on: July 21, 2014, 12:14:40 AM »

thank you very much stworthy for your reply very much appreciated I will try the code and comeback for the outcome
Logged
john17
Newbie
*
Posts: 17


View Profile Email
« Reply #3 on: July 21, 2014, 01:33:01 AM »

hi guys,

for the sake of others here's what I've done

Code:
<table id="dg2" class="easyui-datagrid" style="width:auto;max-width:1300px;height:auto" rownumbers="true" fitColumns="true" singleSelect="true" autoRowHeight="false">
                        <thead>
                            <tr>
                                <th field="company_clinic_name" width="30" sortable="true">Clinic Name</th>
                                <th field="Municipality" width="50" sortable="true">Municipality</th>
                                <th field="Province" width="50" sortable="true">Province</th>
                            </tr>
                        </thead>
                    </table>

Code:
var row = $('#dg').datagrid('getSelected');
            if (row){
                
                $('#dg2').datagrid({
                    url:'get-clinic.html?clinid='+row.system_md_id
                });
}

Quote
noted! this data grid is inside a edit dialog box my reference is in my first comment

Quote
Thank you stworthy!!
« Last Edit: July 21, 2014, 01:36:02 AM by john17 » 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!