Alaska Software Inc. - Receiving a POST from a JQuery Grid
Username: Password:
AuthorTopic: Receiving a POST from a JQuery Grid
Stephen BryanReceiving a POST from a JQuery Grid
on Thu, 09 Apr 2015 16:12:26 -0400
I'm using a JQuery grid plugin in a /CXP app that has a method to export the 
grid to a CSV or XML file.
It sends a POST to a PHP script that then sends the filename and XML data 
back to the browser and prompts the user to save it.

I was hoping to port the script to /CXP so I wouldn't need to install PHP on 
the server just for this but when I try to debug the /CXP script it doesn't 
appear to be receiving any parameters. The ::HttpRequest and ::Params 
collections are empty but I can see the posted data in the object inspector 
under ::Host:IOSocket:PendingData.

Needless to say I haven't gotten very far because of this.

Am I doing something wrong or is there something else I need to do to see 
the parameters?



This is the working PHP script that I'm trying to port.


********************************************************

if (isset($_POST["excel"]) && isset($_POST["extension"]))
{
    $extension = $_POST["extension"];
    if ($extension == "csv" || $extension == "xml")
    {
        session_start();
        $_SESSION['excel'] = $_POST['excel'];
        $filename = "pqGrid." . $extension;
        echo $filename;
    }
}
else if(isset($_GET["filename"]))
{
    $filename = $_GET["filename"];
    if ($filename == "pqGrid.csv" || $filename == "pqGrid.xml")
    {
        session_start();
        if (isset($_SESSION['excel'])) {
            $excel = $_SESSION['excel'];
            $_SESSION['excel']=null;
            header('Content-Disposition: attachment; 
filename="'.$filename.'"');
            header('Content-Type: text/plain');
            header('Content-Length: ' . strlen($excel));
            header('Connection: close');
            echo $excel;
            exit;
        }
    }
}
************************************************************
Nestor G. TorresRe: Receiving a POST from a JQuery Grid
on Sat, 11 Apr 2015 07:20:12 +0200
Hi Stephen,

When I find that CXP can not handle some of my processing requirements 
then I turn to Javascript or ASP.

I found this Javascript solution on the net. I am not sure if you would 
try it... here is the link enjoy:

http://stackoverflow.com/questions/28642915/export-jqgrid-data-to-excel-using-javascript

Regards,
Nestor

On 2015/04/09 10:12 PM, Stephen Bryan wrote:
> I'm using a JQuery grid plugin in a /CXP app that has a method to export
> the grid to a CSV or XML file.
> It sends a POST to a PHP script that then sends the filename and XML
> data back to the browser and prompts the user to save it.
>
> I was hoping to port the script to /CXP so I wouldn't need to install
> PHP on the server just for this but when I try to debug the /CXP script
> it doesn't appear to be receiving any parameters. The ::HttpRequest and
> ::Params collections are empty but I can see the posted data in the
> object inspector under ::Host:IOSocket:PendingData.
>
> Needless to say I haven't gotten very far because of this.
>
> Am I doing something wrong or is there something else I need to do to
> see the parameters?
>
>
>
> This is the working PHP script that I'm trying to port.
>
>
> ********************************************************
>
> if (isset($_POST["excel"]) && isset($_POST["extension"]))
> {
>     $extension = $_POST["extension"];
>     if ($extension == "csv" || $extension == "xml")
>     {
>         session_start();
>         $_SESSION['excel'] = $_POST['excel'];
>         $filename = "pqGrid." . $extension;
>         echo $filename;
>     }
> }
> else if(isset($_GET["filename"]))
> {
>     $filename = $_GET["filename"];
>     if ($filename == "pqGrid.csv" || $filename == "pqGrid.xml")
>     {
>         session_start();
>         if (isset($_SESSION['excel'])) {
>             $excel = $_SESSION['excel'];
>             $_SESSION['excel']=null;
>             header('Content-Disposition: attachment;
> filename="'.$filename.'"');
>             header('Content-Type: text/plain');
>             header('Content-Length: ' . strlen($excel));
>             header('Connection: close');
>             echo $excel;
>             exit;
>         }
>     }
> }
> ************************************************************
>
Stephen BryanRe: Receiving a POST from a JQuery Grid
on Sat, 11 Apr 2015 07:07:19 -0400
Hi Nestor,

I was in a bit of a hurry so I just installed PHP and used the existing 
script I had.

I was mainly curious why /cxp wasn't seeing the parameters the way I was 
expecting. A limitation of /cxp, a bug perhaps, or was I just doing 
something wrong. Hopefully one of the Alaska support guys will chime in.

Regards,
Stephen


>"Nestor G. Torres" wrote in message 
>news:24639b87$791f5fee$4d62c@news.alaska-software.com...

>Hi Stephen,

>When I find that CXP can not handle some of my processing requirements then 
>I turn to Javascript or ASP.

>I found this Javascript solution on the net. I am not sure if you would try 
>it... here is the link enjoy:

>http://stackoverflow.com/questions/28642915/export-jqgrid-data-to-excel-using-javascript

>Regards,
>Nestor

>On 2015/04/09 10:12 PM, Stephen Bryan wrote:
> I'm using a JQuery grid plugin in a /CXP app that has a method to export
> the grid to a CSV or XML file.
> It sends a POST to a PHP script that then sends the filename and XML
> data back to the browser and prompts the user to save it.
>
> I was hoping to port the script to /CXP so I wouldn't need to install
> PHP on the server just for this but when I try to debug the /CXP script
> it doesn't appear to be receiving any parameters. The ::HttpRequest and
> ::Params collections are empty but I can see the posted data in the
> object inspector under ::Host:IOSocket:PendingData.
>
> Needless to say I haven't gotten very far because of this.
>
> Am I doing something wrong or is there something else I need to do to
> see the parameters?
>
>
>
> This is the working PHP script that I'm trying to port.
>
>
> ********************************************************
>
> if (isset($_POST["excel"]) && isset($_POST["extension"]))
> {
>     $extension = $_POST["extension"];
>     if ($extension == "csv" || $extension == "xml")
>     {
>         session_start();
>         $_SESSION['excel'] = $_POST['excel'];
>         $filename = "pqGrid." . $extension;
>         echo $filename;
>     }
> }
> else if(isset($_GET["filename"]))
> {
>     $filename = $_GET["filename"];
>     if ($filename == "pqGrid.csv" || $filename == "pqGrid.xml")
>     {
>         session_start();
>         if (isset($_SESSION['excel'])) {
>             $excel = $_SESSION['excel'];
>             $_SESSION['excel']=null;
>             header('Content-Disposition: attachment;
> filename="'.$filename.'"');
>             header('Content-Type: text/plain');
>             header('Content-Length: ' . strlen($excel));
>             header('Connection: close');
>             echo $excel;
>             exit;
>         }
>     }
> }
> ************************************************************
>
Nestor G. TorresRe: Receiving a POST from a JQuery Grid
on Sat, 11 Apr 2015 14:07:38 +0200
I'm the same; can not wait for answer that I know will be a long time 
coming.

On 2015/04/11 01:07 PM, Stephen Bryan wrote:
> Hi Nestor,
>
> I was in a bit of a hurry so I just installed PHP and used the existing
> script I had.
>
> I was mainly curious why /cxp wasn't seeing the parameters the way I was
> expecting. A limitation of /cxp, a bug perhaps, or was I just doing
> something wrong. Hopefully one of the Alaska support guys will chime in.
>
> Regards,
> Stephen
>
>
>> "Nestor G. Torres" wrote in message
>> news:24639b87$791f5fee$4d62c@news.alaska-software.com...
>
>> Hi Stephen,
>
>> When I find that CXP can not handle some of my processing requirements
>> then I turn to Javascript or ASP.
>
>> I found this Javascript solution on the net. I am not sure if you
>> would try it... here is the link enjoy:
>
>> http://stackoverflow.com/questions/28642915/export-jqgrid-data-to-excel-using-javascript
>>
>
>> Regards,
>> Nestor
>
>> On 2015/04/09 10:12 PM, Stephen Bryan wrote:
>> I'm using a JQuery grid plugin in a /CXP app that has a method to export
>> the grid to a CSV or XML file.
>> It sends a POST to a PHP script that then sends the filename and XML
>> data back to the browser and prompts the user to save it.
>>
>> I was hoping to port the script to /CXP so I wouldn't need to install
>> PHP on the server just for this but when I try to debug the /CXP script
>> it doesn't appear to be receiving any parameters. The ::HttpRequest and
>> ::Params collections are empty but I can see the posted data in the
>> object inspector under ::Host:IOSocket:PendingData.
>>
>> Needless to say I haven't gotten very far because of this.
>>
>> Am I doing something wrong or is there something else I need to do to
>> see the parameters?
>>
>>
>>
>> This is the working PHP script that I'm trying to port.
>>
>>
>> ********************************************************
>>
>> if (isset($_POST["excel"]) && isset($_POST["extension"]))
>> {
>>     $extension = $_POST["extension"];
>>     if ($extension == "csv" || $extension == "xml")
>>     {
>>         session_start();
>>         $_SESSION['excel'] = $_POST['excel'];
>>         $filename = "pqGrid." . $extension;
>>         echo $filename;
>>     }
>> }
>> else if(isset($_GET["filename"]))
>> {
>>     $filename = $_GET["filename"];
>>     if ($filename == "pqGrid.csv" || $filename == "pqGrid.xml")
>>     {
>>         session_start();
>>         if (isset($_SESSION['excel'])) {
>>             $excel = $_SESSION['excel'];
>>             $_SESSION['excel']=null;
>>             header('Content-Disposition: attachment;
>> filename="'.$filename.'"');
>>             header('Content-Type: text/plain');
>>             header('Content-Length: ' . strlen($excel));
>>             header('Connection: close');
>>             echo $excel;
>>             exit;
>>         }
>>     }
>> }
>> ************************************************************
>>
>