Search code examples
jqueryjquery-easyui

jquery easyui datagrid row link


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


Solution

  • function viewOrder(){
            var row = $('#dg').datagrid('getSelected');
            if (row){   
            url = "/include/functions/reports/purchase_order.php?id=" +row.id;
                window.open(url);           
            }