/** * Generates a widget to show a html grid * * @param \Engine\Crud\Grid $grid * @return string */ public static function _(\Engine\Crud\Grid $grid) { $code = ' <h1>' . $grid->getTitle() . '</h1> <table id="' . $grid->getId() . '" autowidth="true" class="' . $grid->getAttrib('class') . ' table table-bordered table-hover">'; return $code; }
/** * Generates a widget to show a dojo grid layout * * @param \Engine\Crud\Grid $grid * @return string */ public static function _(\Engine\Crud\Grid $grid) { $gridDivId = 'gridDiv_' . $grid->getId(); $code = ' <div id="' . $gridDivId . '"></div> '; return $code; }
/** * Generates a widget to show a html grid * * @param \Engine\Crud\Grid $grid * @return string */ public static function _(\Engine\Crud\Grid $grid) { $code = ' require([\'dojo/_base/lang\', \'dojox/grid/DataGrid\', \'dojo/data/ItemFileWriteStore\', \'dojo/dom\', \'dojo/domReady!\'], function(lang, DataGrid, ItemFileWriteStore, dom) { '; $gridDivId = 'gridDiv_' . $grid->getId(); $code .= ' /*create a new grid*/ var grid = new DataGrid({ id: \'' . $grid->getId() . '\', store: store, structure: layout, rowSelector: \'20px\' }); /*append the new grid to the div*/ grid.placeAt("' . $gridDivId . '"); /*Call startup() to render the grid*/ grid.startup(); });'; return '<script>' . $code; }