PDA

View Full Version : Grid data update from file



nani_chinni
4 May 2010, 10:59 PM
Hi,


I am using editor grid to display content of XML file. After doing some changed in grid, i am saving that as one xml file in some location.

I want lo upload that updated XML file into grid.

But i don't know how to update a grid through upload file option.

If anybody knows, please let me know.

Thanks,
chinni.

Rothariger
5 May 2010, 12:58 AM
you could use an XmlStore (http://www.extjs.com/deploy/dev/docs/source/XmlStore.html#cls-Ext.data.XmlStore) and in the url you set your server xml file... and thats it...

nani_chinni
6 May 2010, 10:49 PM
Hi,

Thanks for giving reply.
Actually while clicking upload button, user will give his own xml file. So, how can i know the file location and get store from that file?

Thanks.

Rothariger
6 May 2010, 10:59 PM
you want to load a xml file located at client side???

i dont know if that is possible, i think that for security reasons you couldnt...

Condor
6 May 2010, 11:20 PM
You can't upload data using javascript (due to browser restrictions).

You can however, PUT your XML data to the server (does your server handle PUT requests?).

nani_chinni
19 May 2010, 12:51 AM
Thanks for giving reply Condor.

I want to use PHP to read data from file. So, how can i store JSON array into Grid.

I want to update grid using that JSON Array.

Condor
19 May 2010, 1:17 AM
So you have:
1. A form to upload the file.
2. A PHP file to process the uploaded file that stores the data somewhere.
3. A PHP file that returns that data in JSON or XML.
Correct?

nani_chinni
19 May 2010, 9:11 PM
Yes Condor,

I am doing that only. Now, i want to display that JSON array in the form of grid.

So, please tell me that how can i insert or display that data in grid format?

Thanks.

Condor
19 May 2010, 10:16 PM
I don't see the problem... You simply load the grid store with the response from the server.

nani_chinni
19 May 2010, 10:38 PM
Hi,

Actually server returns response in the form of json array.
Where as my grid store is array store.

i have tried with below. But, not getting result.

var result = response.responseText;

store.loadData(result);

If is there any other way, please let me know.

Thanks.

Condor
20 May 2010, 12:27 AM
var result = response.responseText;
var data = Ext.decode(result);
store.loadData(data);