PDA

View Full Version : Need help in using Edit-grid.



Ram Manoj
19 May 2007, 11:19 PM
I am trying to use grids. The problem comes with setting up the data store.

In the edit-grid/xml-grid example of Ext.

The code is like this:
proxy: new Ext.data.HttpProxy({url: 'plants.xml'})

While I want to load the grid with a similar file from my server.

I have changed the code to:
proxy: new Ext.data.HttpProxy({url: 'http://192.168.0.50:8888/bas/plants.xml'})

I see no contents as part of grid, while showing a script error i.e. Expected: ';' in Internet Explorer. I have made sure I have not made any semi-colon or syntax mistake.

Upon searching through forums, I came to realise to read docs of HttpProxy where the following is given

For cross-domain access to remote data, use an Ext.data.ScriptTagProxy.
Be aware that to enable the browser to parse an XML document, the server must set the Content-Type header to "text/xml".

So I changed the proxy line to :
proxy: new Ext.data.ScriptTagProxy({url:'http://192.168.0.50:8888/bas/plants.xml'})

Still the page shows the same error i.e. Expected: ';' in Internet Explorer without contents as part of grid.

By the way I did not change content of plants.xml from Ext download examples and sent the same content as part of
'http://192.168.0.50:8888/bas/plants.xml'. Offcourse this url opens properly from a new browser window.

I was desperate to use Edit-grid in my application. But could not atleast use the Xml-grid.
I tried all ways of using grids and read through forums.

I even tried to use yui-ext xml-grid example which seems to work accordingly when I replace dataModel.load('sheldon.xml');

with
dataModel.load('http://192.168.0.50:8888/bas/sheldon.xml');

But I cannot go back to yui-ext when the world is moving towards Ext.


Please help.

Jacka
22 May 2007, 4:43 AM
Hi!

Did you seen the Screencast from Scott Walter about the editor grid?

Here is my code for the data store:


// create the Data Store
var dsSupplier = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'url:'http://dragon/php/store.php'}),
reader: new Ext.data.JsonReader({
root: 'supplier',
id: 'id'
},
[
{name: 'description'},
{name: 'id'}
])
});


And the JSON data looks like:


{"supplier":[{"description":"supplier1","id":"1"},{"description":"supplier2","id":"2"}]}


It is also possable to use an xml reader!

Kind regards,
Jacka