rabbit
13 Nov 2007, 3:56 PM
I have the following script which is from the examples for grid. This does not render the grid at all. the response that i get from the xml (which i ran separately) is :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<select>
<options>
<option>Select Project</option>
</options>
<options>
<option>Project 1</option>
</options>
<options>
<option>Project 2</option>
</options>
</select>
the script is :
<script>
Ext.onReady(function(){
function formatBoolean(value){
return value ? 'Yes' : 'No';
};
function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
};
// shorthand alias
var fm = Ext.form, Ed = Ext.grid.GridEditor;
var cm = new Ext.grid.ColumnModel([{
header: "Project Name",
dataIndex: 'option',
width: 220
} ]);
// by default columns are sortable
cm.defaultSortable = true;
// this could be inline, but we want to define the Plant record
// type so we can add records dynamically
var Plant = Ext.data.Record.create([
// the "name" below matches the tag name to read, except "availDate"
// which is mapped to the tag "availability"
{name: 'option', type: 'string'}
]);
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({disableCaching:true,method: 'GET',url: 'http://piias2761.ms.com:7780/pbefficiency/servicestracker/webapp/suggestBCProject.jsp?c=0408200408540539&o=CD280305-1515-30'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have a "plant" tag
record: 'options'
}, Plant)
});
// create the editor grid
var grid = new Ext.grid.EditorGrid('editor-grid', {
ds: ds,
cm: cm,
enableColLock:false
});
var layout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(grid)]
}
}, 'grid-panel');
// render it
grid.render();
ds.load();
});
</script>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<select>
<options>
<option>Select Project</option>
</options>
<options>
<option>Project 1</option>
</options>
<options>
<option>Project 2</option>
</options>
</select>
the script is :
<script>
Ext.onReady(function(){
function formatBoolean(value){
return value ? 'Yes' : 'No';
};
function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
};
// shorthand alias
var fm = Ext.form, Ed = Ext.grid.GridEditor;
var cm = new Ext.grid.ColumnModel([{
header: "Project Name",
dataIndex: 'option',
width: 220
} ]);
// by default columns are sortable
cm.defaultSortable = true;
// this could be inline, but we want to define the Plant record
// type so we can add records dynamically
var Plant = Ext.data.Record.create([
// the "name" below matches the tag name to read, except "availDate"
// which is mapped to the tag "availability"
{name: 'option', type: 'string'}
]);
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({disableCaching:true,method: 'GET',url: 'http://piias2761.ms.com:7780/pbefficiency/servicestracker/webapp/suggestBCProject.jsp?c=0408200408540539&o=CD280305-1515-30'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have a "plant" tag
record: 'options'
}, Plant)
});
// create the editor grid
var grid = new Ext.grid.EditorGrid('editor-grid', {
ds: ds,
cm: cm,
enableColLock:false
});
var layout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(grid)]
}
}, 'grid-panel');
// render it
grid.render();
ds.load();
});
</script>