Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ChaJong, Kim on Jan 22, 2009 17:36
open dhtmlx forum
How can I call PL/SQL script in dhtmlGrid.

I am a CIO & CEO of the DBvalley.
We are involved in making web application and now interested in adapting your Dhtmlx Component into our application.
I think your Dhtmlx is just what we want in long time.
There is one question, our base language is PL/SQL , so I wondering Dhtmlx support PL/SQL (function, procedure, package).

If it is possible, please give me a sample to show how to call PL/SQL script .

When I call mygrid.loadXML, I meet error such as "Error Type : loadXML Description : Incorrect XML".
In that case, I type [http://www.dbvalley.com/web/aaa] and then I get XML code that is what we want.

here is sample source.

1. PL/SQL Script (Simple)

CREATE OR REPLACE PROCEDURE AAA
IS
BEGIN
htp.p('
<?xml version="1.0" encoding="iso-8859-1" ?>
<rows>
<row id="11">
<cell>0</cell>
<cell>111</cell>
</row>
</rows>
');
END;

2. dhtml source
....
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("../../codebase/imgs/");
mygrid.setHeader("Column A, Column B");
mygrid.setInitWidths("200,*")
mygrid.setColAlign("right,left")
mygrid.setColTypes("ro,ed");
mygrid.setColSorting("int,str")
mygrid.enableAutoHeight(true,"400");
mygrid.init();
mygrid.loadXML("/web/aaa"); //web is DAD name, aaa is procedure
// mygrid.loadXML("grid.xml");
</script>
....

I am look forward to receiving good result from you.
thank you.
Answer posted by Support on Jan 23, 2009 01:45
>>so I wondering Dhtmlx support PL/SQL (function, procedure, package)
The components are fully client side, they can't directly connect to DB and execute SQL code, to do so they require some intermediate server script


in js code
   grid.loadXML("some.do")

in server side code of some.do
 connect_to_db()
 print_as_xml(  run_sql(some) );

So components load data as XML|JSON from any kind of server side script, which may connect to DB and execute any code. 

>> I meet error such as "Error Type : loadXML Description : Incorrect XML".
Please check next article
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Common_Problems_in_Grid.html#grid_art_comprob

>>1. PL/SQL Script (Simple)
I'm not sure how it must be written for PL/SQL , but be sure that XML response from "/web/aaa" has content-type:text/xml - it necessary for browser to process xml correctly