EasyUI Forum
September 14, 2025, 11:53:09 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: Get datagrid row from inside another datagrid embeded in a dialog box  (Read 10389 times)
andrux
Newbie
*
Posts: 26


View Profile
« on: May 08, 2013, 06:36:53 AM »

Hello, all.

I have a datagrid that works great, then when I click the EDIT button I open up a dialog box where I put another datagrid with some properties for the selected row, when I hit the SAVE button I want to know which row I was editing but it looks like I have no access to it.

Here's how I initialize my datagrid:

Code:
$( '#my-second-dg' ).edatagrid({
title: 'Role Permissions',
url: 'get_items_list.php&id=' + paramId,
...... // more parameters here
});

So, I set paramId with the row id from my main datagrid, but when I initialize my second datagrid paramId is empty.

Anybody knows how can I achieve that?
Logged
andrux
Newbie
*
Posts: 26


View Profile
« Reply #1 on: May 08, 2013, 08:56:17 AM »

Ok, I finally got it working.

What I did was just to grab the selected row before calling edatagrid() and setup my url variable, if there wasn't a selected row then just use a dummy string, like so:

Code:
var paramId = ( $( '#my-first-dg' ).datagrid( 'getSelected' ) === null ) ? '0' : $( '#my-first-dg' ).datagrid( 'getSelected' ).id;

$( '#my-second-dg' ).edatagrid({
title: 'Role Permissions',
url: 'get_items_list.php&id=' + paramId,
...... // more parameters here
});

Took quite some time to figure it out but that's the way I was able to fix my issue.

Thanks for reading everyone
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!