e-xgen extjs scafolding for admin

(Jedi Biru) #1

Dear yii-ers,

e-xgen is giix Extjs Generator, an Extjs code generator for Yii PHP framework.

e-xgen is inspired and based on giix by mentel, gii-template-collection (gtc), by Herbert Maschke (thyseus), and additional webapp theme from derelict.


e-xgen is inspired and uses code from giix, Yii PHP framework and gii-template-collection, i only add some function to generate extjs crud template(i’m trying to make the template as simple as possible, so input are welcome). Many thanks to Qiang Xue, Mentel ,Herbert Maschke, derelict and the contributors of these software.

features from e-xgen :

  • generate extjs store from table definition

  • generate extjs grid and column header, and basic create, update and delete control

  • generate extjs form based on table definition (including combo for foreign key contraint) and basic create update operation.

  • additional webapptheme (but with giix foreign key support)

Features from giix:

giix extends Yii’s gii by providing:

  • Proper handling of related model attributes, rendering appropriate form fields based on relation type.

  • More support for HAS_MANY and MANY_MANY relations.

  • Native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.

  • Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple.

  • Automatic string representation for a model via GxActiveRecord::representingColumn() and GxActiveRecord::__toString().

  • Better i18n support and easier to maintain: support to active record labels. You change the label once in the model and it is automatically updated in the views. This is especially useful for plurals.

  • Out-of-the box i18n support by using Yii::t().

  • Appropriate form fields are rendered based on model attribute/table field data type.

  • Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.

  • Smart methods can query your database for just the needed data (usually the primary key and the field with the string representantion), avoiding manual setup or a "select *".

  • Extensive use of default method parameters. Appropriate data is found automatically.

  • Some (incipient) support for tables with composite primary keys.

  • Generated code is completely free from styling and formatting. Your CSS controls the presentation.

  • Generated code is (almost) free of comments.

  • Well documented and commented source code. Ohloh says that 40% of the lines in the code are comments! You can understand and modify anything you want.

e-xgen extension link

github link





i’m a yii newbie, i will learn alot from your input and recomendation

thx alot


(A12pct) #2

Thanks a lot about your extension. Can you give a demo or how to use this extension in demo yii with extjs ?

(Jedi Biru) #3

i have allready setup a demo and a custom webapp command to make it easier to start, but i’m still busy at this time, i’m planning to upload it this weekend


(Yuriy Chernyshev) #4

Hi! I try to create CRUD operation through GiixCrudjs Generator but I receive an exception "CWebApplication and its behaviors do not have a method or closure named "getName"."

(Inluxc) #5

Yep, i have the same problem.

(Jedi Biru) #6

ok i’ll check it out sorry for late reply, btw can you tell me step to produce that problem?

(Jedi Biru) #7

@inluxc and @jowee

ok found it, try create a module first before generating the crud js, after that create a model with giix model and controller with giixcrudjs under that module,

please read the requirement in e-xgen extension page

thx for trying my extension

(Inluxc) #8

I did create an Modules.

heres the data im inserting:

Model Class


Controller ID


The models exists and de module too.


Ok i figured out, we have to activate the module in the configuration.

(Inluxc) #9

Sorry, i have another problem, i can get the side bar to load the itens from site/tree/

(Jedi Biru) #10

To get the sidebar load the item, you have to manualy add it to the site controller, on action tree add your previously generated crud with pattern jun."Your model name"Grid, btw I will add edit config after create module base on your input, once again thx for trying my ext

(Jedi Biru) #11

after creating the module, add the module to the config file before running GiixCrudjs… thx for trying the extension…, any input are welcome…

(Jedi Biru) #12

extension page updated on usage section, thx for all, sorry for the delay

(Jacob Moen) #13

Moderator note:

Just wanted to add that MightyMike has been flagged as a spammer as his reply was a direct word by word copy and paste of a previous post in this topic… In case you were wondering where the post went. ;)

(Jedi Biru) #14

thanks, i was wondering indeed… i reply quickly after notification, without read the post first, i didn’t notice it has exact same word as previous post :)

(Jedi Biru) #15

finally get yii working on heroku, stil setting up postgress in heroku, hope i can make the example up and running for today, btw this is the example link http://exgen.herokuapp.com/index.php/site/login, heroku doesn’t allow htaccess so bye bye pretty url :(

(Dinix) #16

Hello, I’m trying version 0.2 of the extension, and I’m really exited to get this working :)

I found it a little hard to get this running so I would like to share my procedure to help anyone else who stumbles here:

First install as described in the extension page, extract zip and place js folder in root, themes folder content in themes, and the other folders in protected/extensions. Enable gii as instructed and add to the imports array ‘ext.giix-components.*’

After installed, you should see in gii a couple new options.

  • Change anything in italics to something you like
  1. Create a Module using gii’s Module generator and name it mymodule

  2. Enable said module in config/main.php: ‘modules’=>array(‘mymodule’, … )

  3. Create a mymodel Model using giix Model Generator (in gii) where you must set module path to: application.modules.mymodule.models

  4. Use the GiixCrudjs Generator with model class: application.modules.mymodule.models.mymodel and Controller ID: mymodule/mymodel . All other settings as default. Remember to change the theme in main.php to make full use of extJS.

Still not newbie friendly but hey, four easy steps :)

Keep up with this extension! It saved my life on a almost dead project.

(Darkcom) #17

“add generated controler to site/tree action, with pattern ‘jun.’ + model name + ‘Grid’, automatic site/tree action will be added in the next release”

could you please give me a sample about "site/tree" action file.

(Jedi Biru) #18

hallo maaf baru baca thx untuk tambahan metode nya, please rate it, karena aga susah install nya ada yg ngasih rate negative… :( thx hatur nuhun sebelumnya

(Jedi Biru) #19

aku udah di reply di forum indo :) thx for using it

(Mf) #20


I’ve installed the e-xgen extension and it works well.

BTW - in my setup I had to use the following in config/main.php to make it work (and to allow the use of gii)













I’m still a yii and extjs newbie and maybe you could answer me some questions:

I have the tables "Master" and a model "Detail" for which generated the code with GiixModel and GiixCrudjs Generator.

This works so far.

Now I have added the extjs code from the grid "Detail" to the form "Master".

The Detail grid is now displayed in the Master Form.

Now the tricky part…

I’m trying now to filter the Detail-grid in the Master-form to the records which belong to the masterform…

So I’ve changed the code in the DetailController to display only some records.

$model = Faktpos::model()->findAll($criteria);



$model = Detail::model()->with('Master')->findAll('MasterID=' . $id)


  • How shall I pass the id of the master record to the detail controller?

  • What do you use for debugging such issues? (How can I see what Yii is doing if I’m clicking on something on the extjs Gui?)

  • Or is there a simpler / better approach?