Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andy Chow on Jun 04, 2009 08:51
open dhtmlx forum
LoadXML Incorrect XML Error

loadXML error...Do you know what happened? There is no javascript error. The XML tags are returned one-by-one on-demand via a Oracle PL/SQL process. They are not stored in filesystem. <Thanks>

Javascript call:
<script>
var mygrid;
function fgetClientSearch(){
// call on-demand process
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=GET_CLIENT_SEARCH',0);
// pass values to application-level variables
get.add('F118_LAST_NAME_SEARCH','P1_LAST_NAME_SEARCH');
get.add('F118_FIRST_NAME_SEARCH','P1_FIRST_NAME_SEARCH');
get.add('F118_SSN_SEARCH','P1_SSN_SEARCH');
get.add('F118_DOB_SEARCH','P1_DOB_SEARCH');
// stored returned XML object in gReturn variable
gReturn = get.get('XML');

if (gReturn) {

// load DHTMLX grid
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("/i/themes/custom/dhtmlx/dhtmlxGrid/dhtmlxGrid/codebase/imgs/");

mygrid.setHeader("CCMS#,DAH,Last Name,First Name,MI,Aliases,SSN,DOB,Gender,Language,Ethnicity");
mygrid.setInitWidths("*,*,*,*,*,*,*,*,*,*,*");

mygrid.setSkin("xp");
mygrid.init();
mygrid.load('"' + gReturn + '"' + ',"xml"');
}
get = null;
}
</script>

On-demand process (Oracle PL/SQL) to return XML:
DECLARE
v_count number := 0;
BEGIN
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ( '<rows>' );

FOR c IN ( select a.mcm_pers_pk,
'1' dah_client,
ltrim(rtrim(a.pers_last_name)) pers_last_name,
ltrim(rtrim(a.pers_first_name)) pers_first_name,
ltrim(rtrim(a.pers_mi)) pers_mi,
a.dob,
a.pers_aka,
decode(a.ssn,null,null,substr(a.ssn,1,3) || '-' || substr(a.ssn,4,2) || '-' || substr(a.ssn,6)) ssn,
b.race_desc,
c.lang_desc,
d.sex_desc,
e.sexual_orientation
from mcm_pers_rev a, mcm_race b, mcm_lang c, mcm_sex d, code_sexual_orientation e
where a.ethnicity = b.race_code
and a.primary_lang = c.lang_code
and a.sex = d.sex_code
and a.sexual_orientation = e.sexual_orientation_code (+)
and a.pers_last_name like upper( v('F118_LAST_NAME_SEARCH') ) || '%'
and a.pers_first_name like upper( v('F118_FIRST_NAME_SEARCH') ) || '%'
and nvl( a.ssn,'0' ) like replace( v('F118_SSN_SEARCH'),'-',NULL) || '%'
and nvl( a.dob,sysdate ) like to_date( v('F118_DOB_SEARCH'),'MM/DD/RRRR' ) || '%'
order by a.pers_last_name, a.pers_first_name )
LOOP
v_count := v_count + 1;

HTP.prn ( '<row id="' || v_count || '">' );
HTP.prn ( '<cell>' || htf.escape_sc(c.mcm_pers_pk) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.dah_client) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.pers_last_name) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.pers_first_name) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.pers_mi) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.pers_aka) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.ssn) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.dob) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.sex_desc) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.lang_desc) || '</cell>' );
HTP.prn ( '<cell>' || htf.escape_sc(c.race_desc) || '</cell>' );
HTP.prn ( '</row>' );
END LOOP;

HTP.prn ( '</rows>' );
END;

Answer posted by Support on Jun 04, 2009 09:38
Is gReturn  in above code an XML string? In such case it need to be loaded in grid with 
             mygrid.parse(gReturn,"xml"'); 

load command - load data from external url
parse - loads data from local string|object
Answer posted by Andy on Jun 04, 2009 14:10

Hi,

Yes, you are right.  I changed it to mygrid.parse(gReturn,"xml") and it worked - gReturn is a local variable that stores the XML object returned by the on-demand process.

Btw, now I know I can integrate this product with Oracle Apex.  I only concern about the performance with the big datasets.  Do you have something called "SmartRending"?  Does it support pagination?  Do I have to buy the commercial license?

Thanks.

Andy

Answer posted by Andy Chow on Jun 04, 2009 14:50

Also, how can I turn on pagination - toolbar, bricks, etc.?  I think I downloaded the open-source version of DHTMLX grid.  Do I have to buy the latest commercial version?  What are the additional lines of code that I have to add to the javascript?

Thanks.

Andy

Answer posted by Support on Jun 05, 2009 02:58
>>Do you have something called "SmartRending"? Does it support pagination? Do I have to buy the commercial license?
There are two modes which can be used to work with big datasets
      smart-rendering - exist in both pro and standard versions
      paging - exists in pro version only 

You can check the samples of usage at 
                        http://dhtmlx.com/docs/products/dhtmlxGrid/samples/loading_big_datasets/

>>Do I have to buy the latest commercial version? 
Paging exists only in Pro version ( commercial ) , but you can request an evaluation package to check is it suits your need ( contact sales@dhtmlx.com with such request )