Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1615
Webdatatree clientside initialize event
posted

I am using a Webdatatree and I have two javascript functions I need to Initialize in the clientEvents. It looks like you can only have one function called by this event. I tried adding both but only one fires. Below are my functions. One for maintaining scroll position and the other for hiding checkboxes. I was going to try to combine the two but not having any luck yet. Is there a way to initialize both?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<script type="text/javascript">

 

 

function HideCheckbox(node) {

 

 

var

childCount = node.get_childrenCount();

 

 

var

ParentN = node.get_parentNode();

 

 

if (ParentN !== null

) {

 

 

var

checkbox = node._get_checkBox();

 

 

var

checkboxEl = node._get_checkBox().get_element();

 

 

if

(!checkboxEl && node._get_expandCollapseElement()) {

checkboxEl = node._get_expandCollapseElement().nextSibling;

}

 

 

if

(checkboxEl) {

checkboxEl.style.display =

 

"none"

;

}

}

 

 

for (var

x = 0; x < childCount; ++x) {

 

 

var

child = node.get_childNode(x);

HideCheckbox(child);

}

}

 

 

function init(tree, args) {

 

 

var

root = tree.getNode(0);

 

 

while (root != null

) {

HideCheckbox(root);

root = root.get_nextNode();

}

}

 

 

 

 

function maintainScrollBarPosition(sender, args) {

 

 

//subscribe to onscroll event

sender._element.onscroll = onScrollhandler;

 

 

if ($get('<%=HiddenField1.ClientID %>').value !== ""

)

sender._element.scrollTop = $get(

 

'<%=HiddenField1.ClientID %>'

).value;

}

 

 

function onScrollhandler() {

$get(

 

'<%=HiddenField1.ClientID %>'

).value =

$find(

 

'<%=WebDataTree2.ClientID%>'

)._element.scrollTop;

}

 

 

 

</script

>

Parents
No Data
Reply
  • 49378
    Verified Answer
    posted

    Hi jcom39201,

    I have tested your code and it seems to be working beautifully with the exception of root nodes' checkboxes not being hidden upon initialization. After adding the following line:

     

    node._get_checkBoxElement().style.display =

     

    "none";

     

     

    at the beginning of the HideCheckbox() function and calling the maintainScrollbarPosition(tree, args) function at the end of the init function, both of your requirements seem to be functioning as desired.

    Also this line

    if ($get('<%=HiddenField1.ClientID %>').value !== "" )

    should maybe be != .

    I am attaching my test sample which uses your code nad version 9.2

    Please let me know if this helps.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support

     

    WebDataTreeMaintainScrollHideCheckbox (2).zip
Children