sfDatagridPlugin
1.5.3stable
for sf 1.4sf 1.3sf 1.2 MIT
Now at github : https://github.com/cedriclombardot/sfDatagridPlugin
This plugins allow to create an ajax datagrid with sorting columns, line highlight, action on the line with a checkbox, data paging, column search, etc...
Developers
License
Copyright (c) 2008-2009 OpenBusiness SA (info@openbusiness.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
sfDatagrid plugin
This plugins allow to create an ajax datagrid with sorting columns, line highlight, action on the line with a checkbox, data paging, column search, etc...
Depandencies
Prototype must be loaded to the page
Online documentation
Go to http://symfony.swisscenter.com/datagrid
To know How use the Admin Genrator go to http://symfony.spyrit.net
Now Jquery Compatible
If you want to use Jquery Install sfJqueryReloadedPlugin
$this->getActive()->loadHelpers(array('Form', 'JavascriptBase', 'Javascript', 'jQuery',....);
and in app.yml
all:
datagrid:
jsframwork: jquery # prototype or jquery
Now direct rendering for first call
Use :
sfDatagrid::renderDirect($div,$moduleName,$actionName);
AdminGenerator Step By Step :
SetUp the plugin
After download the plugin :
- Clear your cache symfony cc
Open your AppConfiguration.php File
[php]
public function configure()
{
$this->getActive()->loadHelpers(array('Form', 'Javascript', 'Date', 'Url', 'I18N', 'Tag','Asset','Partial'));
}
Init a new admin module
[php]
symfony propel:init-admin YOUR_APP YOUR_MODULE YOUR_MODEL
Edit the yml and change the theme to sfDataGrid
Options for the list: part
In the list part you could set :
list:
display: [] #Like for default theme but using = do Nothing the link is for all cells
hide: [] #Like for default theme
row_action: show # The action to redirect MY_MODULE/{row_action}?id={my_object_id} by default is edit
hide_filters: [] # To hide filters for some column
sort: [] # Like by default
object_actions: # Like default the link is desactivated on column and the partial _list_td_actions is loaded (without td see your cache)
batch_actions: # Like default
max_per_page: # Like default
actions: # Like default
columns_sorting: # If you want to change the render see after
The column sorting allow you to define the column smth_img calling model->getSmthImg() with your render
But sorting on an existin column like that:
[yml]
list:
display: [ smth_img ]
hide_filters: [ smth_img ] # I haven't making the same operation for filters for the moment
sort: [ smth_img, desc ] #Init sort on this col (optional of course)
columns_sorting:
smth_img: smth #Will translate sortin click smth_img to modelPeer::SMTH
Options for the edit: part
The edit could be the same as default, but you could have a special layout by using :
edit:
layout:
row_1: [ field_1, field_2 ]
row_2: [ field_3, field_4 ]
Add in your main css
#sf_admin_container fieldset#sf_datagrid_fieldset_none {
border:0;
}
.form-elem{
float:left;
padding:5px;
}
#sf_admin_container .form-elem label{
width:7em;
text-align: right;
padding:0;
}
.row-form{
clear:both;
}
The columns will bee in float see _edit_form_layout.php
Change title between create and edit
If you want to have a specific title for adding :
new:
title: My specific title # No other options is the same form