开发者

Fetching id of parent node from child node in EXTJS

1000

...some data

      <component id="2">
               ...some data
      </component>
               ....
               ....
      <component id="10">
                ...some data
      </component>
 </components>

I have the above XMl and I want to fetch data from all the components for a particular idea. (For eg. 1000). Currently I'm using record as component.

new Ext.data.Store({ reader: new Ext.data.XmlReader({ record:'component', id:'id' }, [ ...Data to fetched ] })

I'm not able to fetch idea id. I tried using the 开发者_Python百科parentNode.getAttribute() function but due to some reasons it does not work.


I wouldn't use a store for this application.

If you're only interested in pulling the "...some data" out of a component, it's much easier to use a DomQuery.

For example:

var component = Ext.DomQuery('component[id=1000]', xmlParentNode);

This would return an XML node named "component" with a property of id that equals 1000.

See http://dev.sencha.com/deploy/dev/docs/?class=Ext.DomQuery for more details.

Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜