Get the name of parent that is checkbox selected in a gijgo tree

I have the following Gijgo tree and use this code to get all the selected items when a change is made

Tree.on('checkboxChange', function (e, $node, record, state) {
    var dr;
    if (state != 'indeterminate') {
        $.each(Areas, function (i, e) {
            if (e.name == record.text) {
                dr = e;                    
                return false;
            }
        });
        if (dr != undefined) {
         //do stuff
        }

How do I get the name OKX first. At the moment when I check the OKX box the above will start with D613 and do the rest at that level and OKX will be last. Is there a way to get OKX (‘the parent’) out before the other sub items. (Note: OKX is not a member of the group “Areas” but D613 , D652 etc are, if that helps)

enter image description here

Thank you