PDA

View Full Version : Need help using edit-grid



Ram Manoj
20 May 2007, 8:58 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.(:|

jsakalos
21 May 2007, 2:07 AM
Do you use Firefox/Firebug for developing? Are there any errors reported by Firebug? Is the url same domain as the main page?

Ram Manoj
21 May 2007, 6:05 AM
Hi Jozef,

I do use Firefox with Firebug, but not for development but to check cross-browser compatibility of my application.

Anyway, When I opened the edit-grid page in a FireFox browser,
It has shown the following error,

missing ; before statement plants.xml(line14)
<botanical>Aquilegia canadensis</botanical>

"indicating a line as part of plants.xml which is missing ';' before the line" is how i could grasp of it.

But I think that was not the case/problem.

The Edit-grid page and the plants.xml are running from the same 'web-app' but they do reside in different folders.

I will be glad to give more information.
Guide me.

Ram Manoj.

jsakalos
21 May 2007, 6:19 AM
This seems to be some problem with your development environment as if you take the running example from examples page, copy it unmodified and with the same directory structure to your server and it doesn't run, problem must be with your server.

Check your setup and take some example from examples page and make it running from your server. Unchanged! Then you can start to adjust it to your needs.

Ram Manoj
23 May 2007, 1:45 AM
\:D/

Got it ! Got it !!!

Well I did have solved the problem myself,

The problem was not due to my server environment or script errors.
Though some unnoticed negligence on my side.

For now, I am just happy.

I will post the details in a short while, I am sure it would be of 'some use' to others.

Will be back.

Ram Manoj.\:D/

yanidp
22 Jul 2007, 4:51 AM
Hi Ram Manoj,

I've same problem like you ... "missing ; before statement" ... could you please share your experiences.

Thanks before

Ram Manoj
24 Jul 2007, 5:25 AM
Hi Ram Manoj,

I've same problem like you ... "missing ; before statement" ... could you please share your experiences.

Thanks before
Hi Yanidp,

I just want to ask,
1. are you using ScriptTagProxy with grid?
2. and which version of Ext are you using?

If you are using HttpTagProxy with any later or latest version of 'ext-1.0'.
and still you have a problem, it is a syntax error arising out of grid configuration script file.

If not, here are my experiences.

When I tried to implement grids for first time, I have used the initial 'ext-1.0' version of Ext.
And my problem is as follows.


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.


Meanwhile later versions of Ext are released,
And meanwhile I came across Ext-grid screencasts by sfwalter
http://scottwalter.com/screencasts/screencast-grid.zip.

And tried to follow in the same procedure in which he has shown in the Screencast and code files provided.

Somehow using Ext.data.ScriptTagProxy instead of HttpProxy did never worked for me.

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'})


Finally on a fine day I casually tried to use HttpProxy instead of ScriptTagProxy and I was
amused and puzzled. My grid started working.

On reasoning, the initial version 'ext-1.0' has problem with HttpProxy and might have fixed with later versions.

Using ScriptTagProxy for the grid and again and again rightfully following walter's screencasts, I have lost considerable time.

But all the way I can only think it is worth the price, for these really marvellous componets from Ext. All thanks to Jack.

I later never tried out ScriptTagProxy with grid hoping to save anymore time that is left.

Let me know if any further clarifications with edit-grids.

\