Ext JS Zend Model Viewer
by Naneau
The title for this post is quite descriptive. While working on my post on ExtJS grids it dawned on me that all I was doing was rewriting a model definition in JavaScript , for use with the grid. Writing a JSON reader for my Data Store was just mapping it to model fields. And as a lazy programmer, I don’t like doing things twice.
Now, having written JsTable I knew that I could get information about my Zend_Db_Table models from JavaScript itself. JsTable supports the info() function to get information about your models.
1 2 3 4 5 | var model = new JsTable('ModelName'); //create a model of type ModelName var info = model.info(); //find model info |
If I could get this information on the fly, I thought, why not build the grid dynamically. I had of course attempted this once before, but I used a totally different approach that time. I wanted the grid to support paging and sorting. So I wanted to use a “standard” JSON Data Store.
I was amazed to find that this wasn’t at all difficult. And yet the result is both beautiful and handy. Keeping in line with other examples on this site there are three models you can view in the demo, User, Post and Reaction. They are the models I used within my Zend Framework application.
See the demo for an idea of how handy this really is. All that’s needed is an option to make things editable, and I won’t need phpMyAdmin anymore. Ext JS of course has an EditorGrid, so this may not be that challenging at all.
Comments
Hi! This is beautifull! I’m very interested in zend framework with extjs, i think they can be the perfect couple. Can you put the entery code in a zip file or similar to download. I apreciate very much.
See you.
Could you please send me a tgz of this project? I’m trying to learn the Zend Framework and don’t want a blahzeh interface. I believe that ExtJS is just what I’m looking for and your sample app is the only one on the Internet that I’ve found that combines the two.
Buy lorazepam….
Buy lorazepam….