vakata/jstree — Issue #109: progressive_render & json_data
Author: TiTi
Created: 2011-10-24 17:14:12+00:00
State: open

Hi,

I've noticed there is a problem with the progressive_render option of the json_data plugin.

Demo here : http://jsbin.com/isocuc

I'm not using ajax, i'm only using "data" option, which is a JSON object.
If I set the "progressive_render" option to true, there is an exception when you select an item without children ('1.Design' in my example).
The exception is "Uncaught RangeError: Maximum call stack size exceeded".

:-(

I discovered this because the treeview isn't working in IE9 in LOCALHOST.
See : http://jsbin.com/ulilil (same without progressive_render), please reproduce it locally [download the files].
This example is working online, but there is an issue in "local" mode : the treeview open all nodes by default. And the state can't get better if i click/select a node.
Therefore I found the progressive_render bug...

Because I'm currently using a .hta to display a dashboard (=only IE in local), I can't manage to use the jsTree library right now :-(
Is there any workaround ?

I've noticed a "TODO" section regarding IE9 in the jsTree code, maybe this could help you out :

function LoadXML(fname)
{
var xmlDoc = null;
if(window.ActiveXObject) // IE
{
try
{
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
}
catch(err)
{
alert("Can't instanciate ActiveXObject 'Microsoft.XMLDOM', error is: " + err);
}
}
else if(document.implementation && document.implementation.createDocument)	// Firefox, Opera, etc.
{
xmlDoc = document.implementation.createDocument('','',null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.async = false; // make sure that the parser will not continue execution of the script before the document is fully loaded
xmlDoc.load(fname);
return xmlDoc;
}

function LoadXMLString(str)
{
var xmlDoc = null;
try
{
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
}
catch(err)
{
alert("Can't instanciate ActiveXObject 'Microsoft.XMLDOM', error is: " + err);
}
xmlDoc.async = false; // make sure that the parser will not continue execution of the script before the document is fully loaded
xmlDoc.loadXML(str);
return xmlDoc;
}

function GetXSLResult(xml,xsl)
{
if(window.ActiveXObject) // IE
{
return xml.transformNode(xsl);
}
else if(document.implementation && document.implementation.createDocument) // Mozilla, Firefox, Opera, etc.
{
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
return xsltProcessor.transformToFragment(xml,document);
}
return false;
}
function GetBody(xhtml)
{
var html = xhtml.selectSingleNode('html');
var body = html.selectSingleNode('body');
return body.xml;
}

// Usage:

var xsl = LoadXML('test.xsl');
var xml = LoadXML('data.xml');
var xslRes = GetXSLResult(xml, xsl);
var xslResXml = LoadXMLString(xslRes);
$container.html(GetBody(xslResXml));