Beispiel #1
0
 /**
  * Generates grid component object
  *
  * @param \Engine\Crud\Grid\Extjs $grid
  * @return string
  */
 public static function _(Grid $grid)
 {
     $buildStore = $grid->isBuildStore();
     $code = "\n            buildStore: " . ($buildStore ? 'true' : 'false') . ",\n\n            initComponent: function() {\n                var me = this;\n\n                if (me.buildStore) {\n                    Ext.apply(me, {\n                        store : me.createStore(me.store)\n                    });\n                }\n\n                ";
     $editType = $grid->getEditingType();
     if ($editType) {
         $code .= "me.cellEditing = Ext.create('Ext.grid.plugin." . ucfirst($editType) . "Editing', {\n                    clicksToEdit: 2,\n                    listeners: {\n                        scope: me,\n                        edit: me.onEdit\n                    }\n                });\n                me.plugins = me.cellEditing;";
     }
     $code .= "\n                me.columns = me.columnsGet();\n                me.tbar    = me.getTopToolbarItems();\n                me.bbar    = me.getBottomToolbarItems();\n\n                me.callParent(arguments);\n            },\n\n            ";
     /*        me.on('selectionchange', me.onSelect, this);
                     me.on('celldblclick', me.onDbClick, this);
                     me.on('cellclick', me.onClick, this);
                     me.on('keypress', me.onKeyPress, this);
                 },";
             */
     return $code;
 }