Location: PHPKode > projects > Neobill > NeoBill0.5.6/include/dhtmlxTree/doc/kb/dyn_loading.html
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="Dynamical%20loading_files/filelist.xml">
<link rel=Edit-Time-Data href="Dynamical%20loading_files/editdata.mso">
<title>Dynamical loading means loading data on request</title>

<style type="text/css">
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:"";
	margin:0;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:56.7pt 42.5pt 56.7pt 85.05pt;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:483744830;
	mso-list-template-ids:435879032;
	mso-list-style-name:"Current List2";}
@list l0:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:12.0pt;
	mso-bidi-font-size:12.0pt;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	color:blue;
	mso-ansi-font-weight:bold;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:1.5in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:3.0in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:4.5in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1
	{mso-list-id:849370803;
	mso-list-template-ids:1733444914;
	mso-list-style-name:"Spec List";}
@list l1:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	mso-ansi-font-size:14.0pt;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-ansi-font-weight:bold;}
@list l1:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:1.5in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:3.0in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:4.5in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol {margin-bottom:0;}
ul {margin-bottom:0;}
-->
</style>

</head>

<body lang="DE" link="blue" vlink="purple" style="tab-interval:35.4pt">

<h1>Dynamical Loading in dhtmlxTree v.1.x</h1>

<div class=Section1>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>Dynamical loading means loading data on request. You
can split your data into parts by levels and decrease loading time this way.
For example initial xml document will be as follows:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>
<img width=562 height=161 src="imgs/image001.jpg"></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>Just add parameter child=”1” to all nodes which have
dependent elements (children) and child=”0” to all nodes without children.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=GramE><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:EN-GB'>&lt;?xml</span></span><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>
version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot; ?&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;tree
id=”0”&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;<span
class=GramE>item<span style='mso-spacerun:yes'>  </span>text</span>=&quot;Surveillance&quot;
id=&quot;<span style='color:red'>a1</span>&quot; im0=&quot;book.gif&quot; … <span
style='color:red'>child=”1”</span>/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;item
…/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>…<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;item
…/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;item
text=”Low income countries” id=”a333” im0=”book_titel.gif” …<span
style='color:red'> child=”0”</span>&gt;<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><span style='mso-tab-count:1'>            </span>&lt;/tree&gt;<span
style='mso-tab-count:1'> </span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>As dynamical loading needs to process incoming <span
class=GramE>url</span> parameters to work really useful, it would be good to
use some server side programming language like ASP, ColdFusion, JSP or any
other. This is necessary on next stage.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>If you use XML for building the tree, then you already
used the method<o:p></o:p></span></p>

<p class=MsoNormal><span class=GramE><span lang=EN-GB style='color:blue;
mso-ansi-language:EN-GB'>tree.setXMLAutoLoading(</span></span><span lang=EN-GB
style='color:blue;mso-ansi-language:EN-GB'>url)<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>When user trying to open node with child=”1” tree
looks for data on client side first – if no data found, then it goes to server
using URL specified in method mentioned above with id of node added to it,
like: <a href="http://127.0.0.1/myTree/tree.cfm?id=a1"
title="http://127.0.0.1/myTree/tree.cfm?id=a1"><span style='font-family:"Times New Roman";
mso-bidi-font-family:Arial'>http://127.0.0.1/myTree/tree.cfm?id=a1</span></a>,
where “a1” is id of the node which should be opened. So, here you need a server
side language to process incoming id parameter and to put just required part of
XML into response (in our case the xml contains next level of a1 node):<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><span style='mso-tab-count:1'>            </span><span
class=GramE>&lt;?xml</span> version=&quot;1.0&quot;
encoding=&quot;iso-8859-1&quot; ?&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:red;mso-ansi-language:EN-GB'>&lt;tree
id=”a1”&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;item
text=&quot;Bilateral surveillance&quot; id=&quot;a2&quot;
im0=&quot;book.gif&quot; im1=&quot;books_open.gif&quot;
im2=&quot;books_close.gif&quot; <span style='color:red'>child=”1”</span>/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>&lt;item
…/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><span style='mso-tab-count:1'>            </span>&lt;/tree&gt;<span
style='mso-tab-count:1'> </span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>The same should be repeated for each level and each
node that has children. If you xml contains data from Database, it would be
much better to generate xml on request directly from db – otherwise you’d
better use the following way to reduce the number of parts:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>You can split your xml document in any number of parts
(maximum – all levels, minimum - 1). For example you can load not only next
level of children for <i style='mso-bidi-font-style:normal'>a1</i>, but the
whole branch started from the level next to <i style='mso-bidi-font-style:normal'>a1.
</i>In this<i style='mso-bidi-font-style:normal'> </i>case initial loading of
the tree will be rather fast, as you load just one level, then if user opens
some node, the whole branch will be loaded (but not the whole tree), <span
class=GramE>so</span> in any way it is much faster than load the whole tree on
start.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>
Return current item: Neobill