Lazy Load children by XML checkbox false still shows checkbox

32 views
Skip to first unread message

dge...@gmail.com

unread,
Feb 25, 2019, 7:15:45 AM2/25/19
to Fancytree Q&A
Make note that my XML parses and shows up perfectly in the tree after the lazy load so there is nothing wrong with it or the parsing script except that the checkbox on all the nodes that are lazy loaded still show up. This is even though the parser pushes in the value of false for checkbox for each one. I am on jquery 2.23

Here is the XML parser:
function parseFancytreeXml($xml) {
var children = [];

$xml.children("node").each(function() {
var $node = $(this),
subnodes = $node.children("children");

// Create Fancytree NodeData object from <node> element
children.push({
title: $node.children("title").text(),
expanded: $node.attr("expanded"),
folder: $node.attr("folder"),
key: $node.attr("key"),
lazy: $node.attr("lazy"),
tooltip: $node.attr("tooltip"),
checkbox: $node.attr("checkbox"),
children: subnodes.length ? parseFancytreeXml(subnodes) : null
});
});
return children;
}


The XML (not all of it as you really only need to see the NODE and the checkbox tag within it)

<children title="A list of things">
<node key="MPIU 124" checkbox="false" tooltip="Id: 124 | Created: 6/1/2018">
<title>
<a href='MaintenancePlanInUseDetail.pp?Id=124' STYLE='text-decoration:none; color : #000000;'>YM Electrical</a> (124) [Complete] | Device: <a href='Device.pp?DeviceId=7' STYLE='text-decoration:none; color : #000000;'>Van</a> (7)
</title>
<children>
<node folder="true" key="WorkOrder Folder In Use MP 124" checkbox="false" tooltip="">
<title>Work Orders (Qty: 1)</title>
<children>
<node key="Work Order 75" checkbox="false" tooltip="Id: 75">
<title>
<a href='WorkOrder.pp?WorkOrderId=75' STYLE='text-decoration:none; color : #000000;'>YM Electrical (75) | <font color=blue>Complete</font></a>
</title>
</node>
</children>
</node>
</children>
</node>
</children>

mar10

unread,
Feb 26, 2019, 3:14:28 AM2/26/19
to fanc...@googlegroups.com
You are passing the string "false" here

checkbox: $node.attr("checkbox"),

which is truethy. It should be a boolean vale false instead.

dge...@gmail.com

unread,
Feb 26, 2019, 3:24:32 AM2/26/19
to Fancytree Q&A
How do you pass false as a 0 in this instance and I tried to pass in checkbox=0 and it failed.

I decided just to send in unselectable: true on each lazy load item and that actually stops the user from selecting a lazy loaded checkbox even though it is showing up and that is ok.

Reply all
Reply to author
Forward
0 new messages