EasyUI Forum
September 14, 2025, 01:20: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: pass current selected record data in a grid to another php file  (Read 12623 times)
wel
Newbie
*
Posts: 30


View Profile Email
« on: January 14, 2016, 05:23:32 PM »

I use inline grid and I need to pass all the fields values of the current selected record to another php file and same time navigate to this page so I can read values like this:

$myvar = $_REQUEST['field'];

So I added new button on the grid tool bar like this:
Code:
<a href="#" class="easyui-linkbutton" iconCls="icon-more" plain="true" onclick="getSelected()">Detail Page</a>

And the script was like this

Code:
<script type="text/javascript">
    function getSelected(){
        var row = $('#dg').datagrid('getSelected');
        if (row){
            window.location = 'job_detail.php?jd='+row.job_message_id;
</script>

I dont want to pass about 15 fields in a GET way so is there a way to POST all values to job_detail.php page ?
« Last Edit: January 14, 2016, 05:29:06 PM by wel » Logged
wel
Newbie
*
Posts: 30


View Profile Email
« Reply #1 on: January 17, 2016, 11:31:25 AM »

I can read the id and then select from the db all fields again but I was wondering if datagrid can pass the row object with all values to another php page or not ?.
« Last Edit: January 17, 2016, 11:48:46 AM by wel » Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #2 on: January 17, 2016, 06:41:42 PM »

Please try this code to post the selected row to your server.
Code:
var row = $('#dg').datagrid('getSelected');
if (row){
$.post(url, row, fucntion(){
//...
})
}
Logged
wel
Newbie
*
Posts: 30


View Profile Email
« Reply #3 on: January 17, 2016, 06:53:49 PM »

Thanks I tried JQuery post and it really post row to another php page (ex detail.php) but the problem I still stay at the grid page I need to also to move to this new page detail.php to simply display the grid current selected record in a form style, any idea ?
« Last Edit: January 17, 2016, 07:23:50 PM by wel » Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #4 on: January 17, 2016, 10:53:30 PM »

You can't send a post to server by using 'location.href'.
Logged
wel
Newbie
*
Posts: 30


View Profile Email
« Reply #5 on: January 18, 2016, 08:01:03 AM »

Is there any method to send row object to detail.php page and also move to this page ?
Logged
wel
Newbie
*
Posts: 30


View Profile Email
« Reply #6 on: January 18, 2016, 12:11:33 PM »

I found a way , I used cookies and then read the data using json_decode.
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!