Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Issue with jQuery in tree with checkboxes

Apex-UserAug 25 2015 — edited Sep 1 2015

Hi all,

I'm using the jQuery code detailed here to add checkboxes to my apex tree region.

regTree = apex.jQuery("#viewtree").find("div.tree");

regTree.tree({

ui : {

  theme_name : "checkbox"

},

callback : {

  onchange : function(NODE, TREE_OBJ) {

   if (TREE_OBJ.settings.ui.theme_name == "checkbox") {

    var $this = $(NODE).is("li") ? $(NODE) : $(NODE).parent();

    if ($this.children("a.unchecked").size() == 0) {

     TREE_OBJ.container.find("a").addClass("unchecked");

    }

    $this.children("a").removeClass("clicked");

    if ($this.children("a").hasClass("checked")) {

     $this.find("li").andSelf().children("a").removeClass("checked").removeClass("undetermined").addClass("unchecked");

     var state = 0;

    } else {

     $this.find("li").andSelf().children("a").removeClass("unchecked").removeClass("undetermined").addClass("checked");

     var state = 1;

    }

                $this.parents("li").each(function() {

     if (state == 1) {

      if ($(this).find("a.unchecked, a.undetermined").size() - 1 > 0) {

       $(this).parents("li").andSelf().children("a").removeClass("unchecked").removeClass("checked").addClass("undetermined");

       return false;

      } else

       $(this).children("a").removeClass("unchecked").removeClass("undetermined").addClass("checked");

     } else {

      if ($(this).find("a.checked, a.undetermined").size() - 1 > 0) {

       $(this).parents("li").andSelf().children("a").removeClass("unchecked").removeClass("checked").addClass("undetermined");

       return false;

      } else

       $(this).children("a").removeClass("checked").removeClass("undetermined").addClass("unchecked");

     }

    });

   }

  }

       ,onopen : function(NODE, TREE_OBJ) {

           $(NODE).removeClass("open").addClass("closed");

        }

       ,onclose : function(NODE, TREE_OBJ) {

           $(NODE).removeClass("closed").addClass("open");

        }

}

});

But I'm having some issues with the jQuery, where opening and closing the last siblings of a branch doesn't correctly apply the checked/undetermined class to the parent node..

Is anyone able to assist to fix up the jQuery? I'm not confident in jQuery to fix it properly, though I think it may relate to this bit of code:

if ($this.children("a.unchecked").size() == 0) {

     TREE_OBJ.container.find("a").addClass("unchecked");

    }

A working example is here.  If you open department one, then select all the teams, then deselect/select them a couple of times you'll see the state of the parent node gets confused.

Apex is version 4.2.3

Many thanks!

Comments

sb92075
How do this tables are joining and displays the result.
nice example of Cartesian Product!
782493
Thx

Will the below item work ?

Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a, Table2 b, Table3 c, Table4 d
where
a.col4 = b.col4
b.Col3=c.col3
and c.col4(+) = d.col4
Frank Kulash
Answer
Hi,
VJ wrote:
Hi,

Could you please tell me how the below join works

Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a, Table2 b, Table3 c, Table4 d
where
a.col4 = b.col4 (+)
and c.col4(+) = d.col4
(1) There is an inner join between a and b: rows in a will be joined to rows in b if they have the same value of col4.
(2) There is an outer join between c and d: rows in c will be joined to rows in d if they have the same value of col4, but rows from c will appear regardless of whether they match or not.
(3) There are no other join conditions, so there is a cross join between the result sets of (1) and (2): every row in each will be joined to every row in the other.
Marked as Answer by 782493 · Sep 27 2020
860993
This is my thinking method.

first step is cross join and inner join but excludeing left join.
second step is left join.
Select a.col1,a,col2,b.col1,c.col1,d.col1
from Table1 a
inner join Table2 b on a.col4 = b.col4
cross join Table3 c
left join Table4 d on c.col4 = d.col4
782493
Thx
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 29 2015
Added on Aug 25 2015
6 comments
1,563 views