View Full Version : Help with Extjs XML reader

15 Apr 2010, 2:45 AM
Hello, fellow forum members. I am new to Extjs and I am having the following problem:
My Xml reader just doesn't read the xml file that i specify, or the grid doesn't display it. I have read a couple of forum entries before posting this, and some of them were pretty close to my problem. HOWEVER, I do get something differently: I get this message by my javascript debugger (firebug):

chrome://firebug/content/blank.gifExt.DomHelper=function(){var s=null,j=...(){return("DragDrop "+this.id)}}})(); Here is my code of both the xml file and the html:


<?xml version="1.0" encoding="UTF-8"?>

<title>Sexual Healing</title>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<link rel="stylesheet " href="javascript libs/ext-3.2.0/resources/css/ext-all.css">
<script type="text/javascript" src="javascript libs/ext-3.2.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="javascript libs/ext-3.2.0/ext-all.js"></script>
<meta http-equiv="Content-Type" content="text/xml" charset=UTF-8">
{ Ext.BLANK_IMAGE_URL = 'javascript libs/ext-3.2.0/resources/images/default/s.gif';

var book = new Ext.data.Record.create([{name:'title'},{name:'author'},{name: 'year'}]);
var ds = new Ext.data.Store
proxy: new Ext.data.HttpProxy({url: 'baba.xml'}),
reader: new Ext.data.XmlReader
record: 'book',
id: 'title',
totalRecords: 2
}, book)


var cm = new Ext.grid.ColumnModel
{header: "Title", width: 120, dataIndex: 'title'},
{header: "Author", width: 180, dataIndex: 'author'},
{header: "Year", width: 115, dataIndex: 'year'},
cm.defaultSortable = true;
var grid = new Ext.grid.GridPanel('example-grid',
ds: ds,
cm: cm,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
width: 600,
height: 300,
title: 'Framed with Row Selection and Horizontal Scrolling'

ds.load({params:{start: 0, limit: 2}});

<div id="baba"></div>