Results 1 to 2 of 2

Thread: how to select a node containing two children nodes

  1. #1

    Default how to select a node containing two children nodes

    Hi,

    searched a while and could not get a good solution. does anyone know how to use DomQuery (actually it is more about the selector) to select a node with two known children nodes?

    for example.
    Code:
    <root>
       <level1>
          <level2 id="i12" />
          <level3 id="i13" />
          <level4>this value should be read</level4>
       </level1>
       <level1>
          <level2 id="i22" />
          <level3 id="i23" />
          <level4>noise</level4>
       </level1>
    </root>

    basically, I want to read this node <level4>this value should be read</level4> if the 'id' for node <level2> is 'i12' AND the 'id' for node <level3> is 'i13'.

    I tried the following selector:
    Code:
    root > level1:has(level2[id=i12] and level3[id=i13]) > level4
    but it does not work.


    Thanks for any suggestions!


    best,
    Warren

  2. #2

    Default

    I resolved this issue. maybe someone else is interested on the solution:


    Code:
    Ext.DomQuery.pseudos.hasAll =
    function(c, selectors) { var ss = selectors.split('&'), r = [], ri = -1, s; for(var i = 0, ci; ci = c[i]; i++){ var match = true; for(var j = 0; s = ss[j]; j++){ if(Ext.DomQuery.select(s, ci).length<=0){ match=false; break; } } if(match) { r[++ri] = ci; } } return r;
    }




    Quote Originally Posted by ruralclimber View Post
    Hi,

    searched a while and could not get a good solution. does anyone know how to use DomQuery (actually it is more about the selector) to select a node with two known children nodes?

    for example.
    Code:
    <root>
       <level1>
          <level2 id="i12" />
          <level3 id="i13" />
          <level4>this value should be read</level4>
       </level1>
       <level1>
          <level2 id="i22" />
          <level3 id="i23" />
          <level4>noise</level4>
       </level1>
    </root>

    basically, I want to read this node <level4>this value should be read</level4> if the 'id' for node <level2> is 'i12' AND the 'id' for node <level3> is 'i13'.

    I tried the following selector:
    Code:
    root > level1:has(level2[id=i12] and level3[id=i13]) > level4
    but it does not work.


    Thanks for any suggestions!


    best,
    Warren

Similar Threads

  1. TreePanel - Selecting all relative nodes (parents & children) when a node is selected
    By primolan in forum Ext 3.x: User Extensions and Plugins
    Replies: 2
    Last Post: 2 Dec 2009, 5:10 AM
  2. treeLoader and Children Nodes url
    By biggi in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 19 May 2008, 1:50 AM
  3. When I delete a node's children Nodes ,how to refresh it's parentNode?
    By yuhao in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 27 Sep 2007, 1:33 AM
  4. problem copying children nodes
    By yehosef in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 25 Jul 2007, 11:12 AM
  5. XMLDataModel and Parent/Children Nodes
    By vatech1993 in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 27 Nov 2006, 2:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •