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
45
What can i do, for "node" -> "attribute manipulation" with javascript
posted

I want to add a attribute (for example title="UID"... ) to the new node, but it dosen't work. 
I need the title attribute, because in my project there are 3 Typs off nodes:

1. K_56gS5sa  K_ = Typ = Catalog  
2. C_ HG52s2 C_ = Typ = Category
3. P_65jgsG4  P_ = Typ = Product

 I want to manipulation attributes or set new attributes of a new node. 

Here the example Code:

<asp:UpdatePanel ID="UpdatepanelTreeview" runat="server" UpdateMode="Conditional"

          ChildrenAsTriggers="true">

          <ContentTemplate>

 

  <ig:WebDataTree ID="DDWebDataTree" runat="server" StyleSetName="RedPlanet"

              SelectionType="Single" 

              EnableAjax="true" 

              CheckBoxMode="Off" 

              EnableConnectorLines="true"

              EnableAutoChecking="true" 

              EnableAjaxViewState="true"

              OnNodeDropped="DDWebDataTree_NodeDropped" 

              OnNodeClick="DDWebDataTree__NodeClick"

              ClientEvents-DragStart="GetParent" 

              NodeSettings-ParentNodeImageUrl="~/theme/images/tools/catalog.png"

              NodeSettings-LeafNodeImageUrl="~/theme/images/tools/category.png" 

              NodeSettings-ImageUrl="~/theme/images/tools/product.png" 

              DataLoadingMessage="...loading" 

              ViewStateMode="Enabled" >

              <DragDropSettings AllowDrop="true" EnableDragDrop="true">

              </DragDropSettings>

              <AutoPostBackFlags 

                NodeDropped="On" 

                NodeAdded="On" 

                NodeRemoved="On" 

                NodeClick="On"

                NodeEditingTextChanged="On" />

            </ig:WebDataTree>

            <asp:HiddenField ID="HF_Parent" runat="server" Value="" />

 

          </ContentTemplate>

          <Triggers>

            <asp:AsyncPostBackTrigger ControlID="DDWebDataTree" />

          </Triggers>

        </asp:UpdatePanel>

<script>

function addNode(sUID, sName, iTyp) {

  //var nodeText = textBoxNewNode.value;

  var nodeText = sName;

  textBoxNewNode.value = "";

  if (isNullorUndefined(nodeText) || (nodeText == "")) {

    alert("You have to specify a node name.");

    return false;

  }

  var parent = currentTree.get_selectedNodes();

  var location;

  if ((!isNullorUndefined(parent)) && (parent.length > 0)) {

    location = $adrutil.getLocationFromDomElement(parent[0].get_element());

  }

 

  var node = currentTree.createNode(nodeText);

  node.set_valueString(sUID);

  node.set_id(sUID);

  //node.setAttribute("title", sUID);

  node._element.setAttribute("title", sUID)

  if (!isNullorUndefined(location)) {

    currentTree.add(node, location);

 

  }

  else {

    currentTree.add(node, null);

  }

}