Re: CGIDEV2 Program issue DATABLE.NET and Debug in RDI

Jose Perez <[email protected]>
Newsgroups gmane.comp.systems.as400.web
Message-ID <CAMTetCmbTJUXjnK73-N7C-dAynun9Tf2jqwhyrgAYqoKRXMWhQ@mail.gmail.com>
Thk you Scott for your quick response, I know datatable and Jquery is
handle it by my HTML and the browser, I did what you suggested using CHROME
browser inspect and Page source view, the table show up all the data that I
expect on the browser but is not loading the CDN however if I do view page
source and click on the CDN link it works, it show the CDN code. so I
really don't know why is not loading in my html. In regard to debug even
that I say debug my program in RDI with user ID=QTMHHTTP my cgidev2 program
is not getting debugged, program was compiled with *source.

On Wed, Apr 6, 2022 at 12:44 PM Scott Klement <[email protected]>
wrote:

> Hello Jose,
>
> CGIDEV2 doesn't interact directly with DataTable.net.  Instead, CGIDEV2
> builds HTML data that is sent to a web browser.  The browser is what
> interacts with DataTable.net.
>
> Here's how I'd debug it:
>
> 1) Open up the developer tools in your web browser. In Chrome or Firefox
> running on Windows you can use the shortcut key Ctrl-Shift-I to get into
> these tools.  All browsers have tools like this, though -- you'll just
> have to look in the help or menus of your browser to find it.
>
> 2) Navigate to your CGIDEV2 application in the browser.
>
> 3) In the network tab of your browser's tools, you should see the HTTP
> request made to CGIDEV2, and the data that it's getting back. Look at
> the response to see your HTML -- verify that it's formatted the way you
> expect and all is well.
>
> 4) If step (3) showed bad HTML, this is where you need to debug your RPG
> program.  Do that with RDi (or STRDBG it doesn't really matter) and fix
> the HTML.
>
> 5) If step (3) showed good HTML, your browser will have read that HTML
> and made an additional network request to both jquery.com and
> datatables.net.  Look at those to see why they aren't connecting or
> loading.
>
> Hope that helps you get the idea.
> -SK
>
>
>
> On 4/6/2022 11:18 AM, Jose Perez wrote:
> > Hi Fellows I'm having a problem with a CGI Program. I am using
> DATATABLE.NET
> > in my HTML through External CDN but when I render the HTML table it
> doesn't
> > show up  the CDN DATATABLE.NET(https://datatables.net/)  features, it
> seems
> > to me that it doesn't recognize the DATATABLE.NET external CDN  besides
> how
> > do I debug a CGIDEV2 program through RDI.  I know that the user under the
> > DEBUG should be QTMHHTTP but even so the debug is not working in RDI for
> > me.. Below is my HTML Code and my CGIDEV2 Program
> > -----
> > HTML
> > ---/$top
> > Content-type: text/html
> >
> >
> > <!DOCTYPE html>
> > <html>
> > <head>
> > <script
> > src="http://code.jquery.com/jquery-1.11.3.min.js"
> >>
> > </script>
> >
> > <link href="https://nightly.datatables.net/css/jquery.dataTables.css"
> > rel="stylesheet" type="text/css" />
> > <script
> > src="https://nightly.datatables.net/js/jquery.dataTables.js"
> >>
> > </script>
> >
> > <Script>
> > $(document).ready( function () {
> > var table = $('#example').DataTable();
> > } );
> >
> > </script>
> >
> > <meta charset=utf-8 />
> > <title>DataTables - JS Bin</title>
> > </head>
> > <body>
> > <div class="container">
> >
> > /$tabh
> > <table id="example" class="display nowrap" width="100%">
> > <thead>
> > <tr>
> > <th>Last Name</th>
> > <th>Street</th>
> > <th>City</th>
> > <th>State</th>
> > </tr>
> > </thead>
> > <tbody>
> > /$tabd
> >
> > <tr>
> > <td>/%LSTNAM%/</td>
> > <td>/%STREET%/</td>
> > <td>/%CITY%/</td>
> > <td>/%STATE%/</td>
> > </tr>
> > <tr>
> > /$tabe
> >
> > </tbody>
> > </table>
> > </div>
> >
> > /$end
> > </body>
> > </html>
> > -------
> > And my RPG program
> > //
> +----------------------------------------------------------------------
> > // | Program name : CGIDEVLIB/CGITST
> > // | Created On : 03/26/2022
> > // | programmer : Jose E. Perez Marmolejos
> > // | Descr. : This is a sample CGI program
> > // |
> > // |
> > // |
> +=====================================================================
> > // | ***** maintenance history ***** *
> > // +=====================================================================
> > // | *
> > // | Proj/Task# Who When Desc.
> > // +=====================================================================
> >
> > // +-------------------------------------------------------------------+
> > // | File Declaration
> > // +-------------------------------------------------------------------+
> > Ctl-opt dftactgrp(*no);
> > // +-------------------------------------------------------------------+
> > // | Entry Parm, Data Structure, Stand Alone Field Def,Proc Def.n
> > // +-------------------------------------------------------------------+
> > // Copy Book
> > /copy CGIDEVLIB/qrpglesrc,hspecs
> > /copy CGIDEVLIB/qrpglesrc,hspecsbnd
> > /copy CGIDEVLIB/qrpglesrc,prototypeb
> > /copy CGIDEVLIB/qrpglesrc,usec
> > /copy CGIDEVLIB/qrpglesrc,variables3
> >
> > // Stand Alone Fields Definition
> > Dcl-c PGMPATH Const('cgidevlibp');
> > Dcl-s LNAM Char(8);
> > Dcl-s STREET Char(13);
> > Dcl-s CITY Char(6);
> > Dcl-s STATE Char(2);
> >
> > /copy CGIDEVLIB/qrpglesrc,prolog3
> >
> > // +-------------------------------------------------------------------+
> > // | Main Module
> > // +-------------------------------------------------------------------+
> > // Write qualified job name to debug file. The *on
> > // parameter forces output even if debugging is off.
> > // Remove this parameter or change it to *off if you
> > // want the output only if debugging is on.
> > wrtjobdbg(*on);
> >
> > // Ask the service program to load into memory
> > // the HTML member CGISAPBIL
> > // from IFS Folder /Cgidevlib/html/
> > gethtmlifs('/CGIDEVLIB/HTML/datatbltst.HTML');
> >
> > // issue section "top"
> > wrtsection('top');
> >
> > // issue section "tabh"
> > wrtsection('tabh');
> >
> > // Display table detail
> > Exsr $Display_File;
> >
> > // Send the response html buffer and exit
> > // End the HTML
> > wrtsection('end');
> >
> > // Do not delete the call to wrtsection with section name *fini.
> > // It is needed to ensure that all output html that has been buffered
> > // gets output.
> > wrtsection('*fini');
> > return;
> >
> > // +----------------------------------------------------------------+
> > // | $Display_File;
> > // +----------------------------------------------------------------+
> > Begsr $Display_File;
> >
> > //Select SAP Billing records
> > Exec sql
> > Declare C1 Cursor For
> > Select LSTNAM, STREET, CITY, STATE
> >  From QIWS/QCUSTCDT;
> >
> > //Open the cursor
> > Exec Sql Open C1;
> >
> > // Read the cursor
> > Exec sql Fetch C1 into :LNAM, :STREET,
> > :CITY, :STATE;
> >
> > Dow Sqlcode = *zeros;
> >
> >
> > updHTMLvar('LSTNAM':LNAM:'0');
> > updHTMLvar('STREET':STREET);
> > updHTMLvar('CITY':CITY);
> > updHTMLvar('STATE':STATE);
> > wrtsection('tabd');
> >
> > // Read Next record
> > Exec sql Fetch C1 into :LNAM, :STREET,
> > :CITY, :STATE;
> > Enddo;
> >
> > // Close the cursor
> > Exec sql Close C1;
> >
> > // write the end of the table
> > wrtsection('tabe');
> >
> >
> > Endsr;
>
-- 
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.