Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to Ext js and facing certain problem in working with it. Can someone help me out?
Following is the code I am working on.

XML
<html>
<head>
<title> Account Grid </title>
<link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css" />
<script src="../extjs/adapter/ext/ext-base.js"></script>
<script src="../extjs/ext-all.js"></script>
 <script src="../extjs/examples/ux/ux-all.js"></script>
 <script type="text/javascript">

    Ext.onReady(function() {
        var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.load('D:/workspace/Jasper_Report_Test_Tool/resources/xml/account.xml');
        alert(xmlDoc.getElementsByTagName('account').length);

        var store = new Ext.data.XmlStore({
            data : xmlDoc,
            record : 'acccount',
            fields : ['id','account_type','account_no','balance'],
            autoLoad : true
        }); //store

        var grid = new Ext.grid.GridView();
        var colModel = new Ext.grid.ColumnModel([{
            header : 'id',
            sortable : true,
            dataIndex : 'id'
        }, {
            header : 'Account Type',
            dataIndex : 'account_type'
        }, {
            header : 'Account number',
            dataIndex : 'account_no'
        }, {
            header : 'Balance',
            dataIndex : 'balance'
        }]);

        var selModel = new Ext.grid.RowSelectionModel({
            singleSelect : true
        });


         var grid = new Ext.grid.GridPanel({
             title : 'Account Details',     //panel related
             autoHeight : true,         // configurations
             renderTo : Ext.getBody(),
             store : store,             // data store
             //view : gridView,         //related
             colModel :colModel,        //configurations
             selModel : selModel

         }); //gridPanel

    }); //onReady

 </script>

 </head>
 <body>
   <div id ="id1"> </div>

 </body>
 </html>


The grid is displayed but it does not display the values added to the xml file. I took the count of the xmlDoc elements and it gives the proper count of number of elements added. The file is loaded but not getting displayed. Can someone tell me where I went wrong?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900