EasyUI Forum
September 14, 2025, 02:17:15 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: jquery easyui datagrid row link help  (Read 23439 times)
dan
Newbie
*
Posts: 17


View Profile
« on: March 19, 2015, 01:30:38 AM »

Hi, I'm trying to write a custom link on a datagrid. The user has the usual functions 'edit', 'add' & 'delete' but I'm also adding 'view'. All my code works apart from the view function but I cannot work out how to open the selected row in a custom url. What I want to achieve is the user selects a row and then clicks the view button which then transfers the id to the report url.

He's my code that works;-

    function editOrder(){
        var row = $('#dg').datagrid('getSelected');
        if (row){
            $('#dlg').dialog('open').dialog('setTitle','Edit Order');
            $('#fm').form('load',row);
            url = '/include/functions/edit/edit_order.php?id='+row.id;

and here is the code I've tried out but I cant get to work;-

    function viewOrder(){
        var row = $('#dg').datagrid('getSelected');
        if (row){

        $('#fm').form('load',row);
        url = '/include/functions/reports/purchase_order.php?id='+row.id;

Any help is appreciated
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #1 on: March 25, 2015, 07:48:26 AM »

Help anyone, please?Huh  Cry Cry
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: March 25, 2015, 08:19:28 AM »

How do you define the 'view' link? Please describe your question in more detail.
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #3 on: March 25, 2015, 08:51:12 AM »

hi, sorry for the confusion.

I've added another button to the header similar to new/edit/delete but I cant establish the link. Basically the user selects a row (similar to edit) and clicks the view button. It then should transfer this ROW ID to an external page located at /include/functions/reports/purchase_order.php?id='ROW ID HERE; which then displays additional information from the database.

thanks
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #4 on: March 26, 2015, 11:15:30 AM »

I'm not sure I understand the difference between working and not working.  what's the value of url variable after?
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #5 on: March 27, 2015, 12:45:33 AM »

I'm not sure I understand the difference between working and not working.  what's the value of url variable after?

Hi Chrwei, the editOrder code is a working script. I've tried to modify this code in order to open the row ID in another URL. Essentially the jquery easyui datagrid displays minimal details and this url is like a report which will display more values from the database.

I appreciate your help.
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #6 on: March 27, 2015, 06:01:00 AM »

yes, but they looks the same, so you need to provide more details
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #7 on: March 27, 2015, 09:14:07 AM »

yes, but they looks the same, so you need to provide more details

Hi again, the second code doesnt work and is what I've tried to modify. When I use the form and click the view button it does nothing.

Below is the code I have started but it does not work correctly, I believe it is nearly there;-
function viewOrder(){
        var row = $('#dg').datagrid('getSelected');
        if (row){

        $('#fm').form('load',row);
        url = '/include/functions/reports/purchase_order.php?id='+row.id;
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #8 on: April 01, 2015, 01:07:35 AM »

I've managed to be able to load the 'ID' of the selected row using one of the tutorials, here is my code;-

      function viewOrder(){
         var row = $('#dg').datagrid('getSelected');
         if (row){
                alert('Item ID:'+row.id);
         }

I just cannot seem to be able to transfer this row 'ID' to my URL = /include/functions/reports/purchase_order.php?id=

Any ideas anyone???
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #9 on: April 02, 2015, 01:00:24 AM »

Hi all,

I've seen another post which states to use 'window.open' function but again this isn't working for me,  I have something slightly wrong with my code but cannot seem to locate the issue - any ideas people?

      function viewOrder(){
         var row = $('#dg').datagrid('getSelected');
         if (row){          
              window.open(http://WEBSITENAME/include/functions/reports/purchase_order.php?id=)+row.id;   
         }
Logged
dan
Newbie
*
Posts: 17


View Profile
« Reply #10 on: April 02, 2015, 01:36:49 AM »

Solved!

for those who need to know it should be;-
url = "/include/functions/reports/purchase_order.php?id=" +row.id;
                window.open(url);
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!