DOJO xmlStore Child Reference

Discussion in 'Software' started by mpurohit, Jul 14, 2008.

  1. mpurohit

    mpurohit

    Joined:
    Jul 14, 2008
    Messages:
    1
    I am trying to get value of a child node in the field for a given xmlSchema


    I have written this code

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <style type="text/css">


    @import "dojoRoot/dojox/grid/_grid/tundraGrid.css";
    @import "dojoRoot/dijit/themes/tundra/tundra.css";
    @import "dojoRoot/dojo/resources/dojo.css"
    @import "dojoRoot/dijit/tests/css/dijitTests.css";
    @import "dojoRoot/dojox/grid/_grid/tundraGrid.css";





    body {
    font-size: 0.9em;
    font-family: Geneva, Arial, Helvetica, sans-serif;
    }
    .heading {
    font-weight: bold;
    padding-bottom: 1.85em;
    }

    #grid {
    border: 1px solid #333;
    width: 100em;
    height: 50em;
    }
    </style>
    <script type="text/javascript">
    var view1 ='';
    var layout ='';
    var jsonStore ='';
    var xmlStore ='';
    var newModel='';
    var xmlModel='';


    var DOJO_XMLSTORE_PATH='support/dm.xml';
    var mTimer;
    var store='';
    var orderNumber = '1';
    //var grid ='';

    </script>

    <script type="text/javascript" src="dojoRoot/dojo/dojo.js"
    djConfig="isDebug:false, parseOnLoad: true"></script>





    <script type="text/javascript">

    dojo.require("dojox.grid.Grid");
    dojo.require("dojox.grid._data.model");
    dojo.require("dojox.data.XmlStore");
    dojo.require("dojo.parser");
    dojo.require("dojo.data.api.Read");
    dojo.provide("dojo.data.api.Write");
    dojo.require("dojo.data.api.Identity");




    dojo.provide("dojox.data.XmlStoreFix");

    dojo.declare("dojox.data.XmlStoreFix", dojox.data.XmlStore,{
    getIdentity: function(item)
    {
    return this.getValue(item, orderNumber);
    }
    });


    </script>
    </head>
    <body class="tundra" >
    <div class="heading">Application Module</div>
    <div id="nonBodyParentDiv">

    <div id="grid" elasticView="0" dojoType="dojox.Grid" jsId="myGrid" model="" structure="">

    </div>
    </div>


    <input type="button" value="Layout Creation Button" onclick="testOne();" />


    <script type="text/javascript">

    function getRow(inRowIndex){
    return ' ' + inRowIndex;
    }

    function testOne()
    {

    layout = [






    {
    cells: [
    [

    {name: 'Application', width:"25em" , field: "Name" },
    {name: 'Application Name', width:"25em" , field: "ApplObj" },
    {name: 'Port_Type', width:"25em" , field: "Appl" },
    {name: 'PreDefined', field: "PreDefined" }

    ]

    ]

    }
    ];


    store = new dojox.data.XmlStoreFix({url: DOJO_XMLSTORE_PATH, rootItem: "Appl_Cat",keyAttribute:"ID",label:"ID",sendQuery:true});




    var gotBooks = function(items, request)
    {
    for (var i = 0; i < items.length; i++){
    var item = items;

    //alert("### XmlStore:getValue ###"+store.getValue(item, "Name"));
    //alert("### XmlStore:getValue ###"+store.getValue(item, "ApplObj"));

    //alert("### XmlStore:getValue ###"+store.getValue(item, "PreDefined"));

    alert("### XmlStore:getValue ###"+store.getValue(item, "Appl().Port_Config().Dstn_Port().Port_Type"));



    }




    }

    var request = store.fetch({query: {ID:"*"}, queryOptions: {ignoreCase: true}, onComplete: gotBooks});




    xmlModel = new dojox.grid.data.DojoData(null,store,{jsId: 'xmlModel'},{query: { ID:"*"}});


    myGrid.setModel(xmlModel);

    myGrid.setStructure(layout);

    }

    </script>
    </body>


    where xml Shema is


    <DevMana>
    <Catalog>
    <Application>

    <Appl_cat ID>
    <Name></Name>
    <Predef></Predef>
    .....
    <Appl>
    <Port_config>

    ..........
    <dstn_port>
    <Port_type></Port_type>
    <Port1>224</Port1>
    <Port1>1212</Port1>
    </dstn_port>
    <Port_Config>
    </Appl>
    </Appl_cat>
    </Application>
    </Catalog>
    </DevMana>



    Please Tell me how to get value of

    <Port_Type></Port_Type>

    in one of the grid-->column ({name:'Port Type' , field:''}) of the Grid and if You want a grid-->column such that it has :

    "Value of Field One(i.e. Port1)" + "-" + "Value of Field One(i.e. Port2)"

    To be set to a column such that

    <Port1>224</Port1>
    <Port1>1212</Port1>

    It is Displayed as 224-1212 in a column named Port Details
     
    mpurohit, Jul 14, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Herb
    Replies:
    1
    Views:
    699
    John Thompson
    Jan 4, 2005
  2. =?Utf-8?B?QUQgZXJyb3I=?=

    Child domain

    =?Utf-8?B?QUQgZXJyb3I=?=, Jan 8, 2004, in forum: MCSE
    Replies:
    16
    Views:
    1,406
    =?Utf-8?B?R1Q=?=
    Jan 13, 2004
  3. =?Utf-8?B?UGhpbA==?=

    Removing child domains after system restore

    =?Utf-8?B?UGhpbA==?=, Feb 10, 2004, in forum: MCSE
    Replies:
    4
    Views:
    556
    Consultant
    Feb 13, 2004
  4. Steve Freides

    Child-friendly web mail

    Steve Freides, Feb 28, 2004, in forum: Computer Support
    Replies:
    9
    Views:
    2,284
    philo
    Feb 28, 2004
  5. Robertas
    Replies:
    0
    Views:
    724
    Robertas
    Feb 23, 2007
Loading...

Share This Page