PDA

View Full Version : how to use mysql data on ext designer?



alissonfg
29 Mar 2010, 9:45 AM
hi, I need to show some data on grids, but how I connect with mysql?

aconran
29 Mar 2010, 2:01 PM
You can use a server-side language like PHP, ColdFusion, Ruby, Java or .NET to connect to your MySQL server and return JSON or XML.

alissonfg
1 Apr 2010, 5:47 AM
right, I generated a xml file with my mysql database, but

how I configure on ext designer
?

aconran
1 Apr 2010, 11:54 AM
Great, first setup the server you will be working with in Edit -> Preferences. If the data is on http://localhost/ then you can skip this step.

Then go to the Data Stores tab at the top right hand side of the application. Click the arrow dropdown next to Add Json Store. Click Add Xml Store.

You will now have an Xml store in your data stores tab. Select it via your mouse.

Component Config has now become active, you can provide your url.

If you put myApp/sample.xml the request will be generated to your url prefix + the url you provide. (This is intelligent enough to handle things like relative and absolute paths.)

You can then define what a record is. This is the particular Xml node in your xml that represents a record.

Take a look at the following standard Ext example: http://www.extjs.com/deploy/dev/examples/grid/xml-grid.html

Here we've setup the record to "Item". You can see how this corresponds to the Xml.

Next, we need to add fields to our store. Right click the store (or use the overflow menu item option) to add a few fields to the store. You can then configure the name's of these fields within that Item xml node.

aconran
1 Apr 2010, 11:55 AM
As a side note, I would recommend the use of JSON instead of XML for performance reasons.

alissonfg
3 Apr 2010, 5:52 AM
I get to load the xml content of my mysql database

but how I load this "mystore" on a grid? or a data view?

i'm not understanding ext designer,