Author: lombardot
Date: 2010-02-02 16:29:10 +0100 (Tue, 02 Feb 2010)
New Revision: 27423

Modified:
   plugins/sfDatagridPlugin/lib/sfDatagrid.class.php
   plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php
   plugins/sfDatagridPlugin/lib/sfDatagridPropel.class.php
   plugins/sfDatagridPlugin/web/js/datagrid.js
   plugins/sfDatagridPlugin/web/js/jquery.datagrid.js
Log:
[sfDatgridPlugin] Checkall for jquery

Modified: plugins/sfDatagridPlugin/lib/sfDatagrid.class.php
===================================================================
--- plugins/sfDatagridPlugin/lib/sfDatagrid.class.php   2010-02-02 15:11:58 UTC 
(rev 27422)
+++ plugins/sfDatagridPlugin/lib/sfDatagrid.class.php   2010-02-02 15:29:10 UTC 
(rev 27423)
@@ -64,7 +64,8 @@
                // Get the module and the action for url linking
                $this->moduleAction = sfContext::getInstance()->getModuleName() 
. '/' . sfContext::getInstance()->getActionName();
                // Get the sorting options
-               $this->sortBy = $this->request->getParameter(self::P_SORT, 
null);
+               $this->sortBy = $this->request->getParameter(self::P_SORT, 
null);
+               
                $this->sortOrder = $this->request->getParameter(self::P_ORDER, 
null);
                
                $this->search = $this->request->getParameter('search');
@@ -136,7 +137,8 @@
                        }
                        
                        if(count($cookie) >= 4 && is_null($this->sortBy) && 
is_null($this->sortOrder))
-                       {
+                       {
+                               
                                $this->page = $cookie[0];
                                $this->sortBy = $cookie[1];
                                $this->sortOrder = $cookie[2];
@@ -377,7 +379,7 @@
                                $this->sortBy = $this->defaultSort['sort'];
                        }
                        else
-                       {
+                       {
                                $columnsKeys = array_keys($this->columns);
                                $this->sortBy = $columnsKeys[0];
                        }
@@ -643,7 +645,7 @@
         */
        public static function getCheck($value)
        {
-               $html = '<input type="checkbox" name="gridline[]" value="' . 
$value . '" />';
+               $html = '<input type="checkbox" name="gridline[]" 
class="gridline_chk" value="' . $value . '" />';
                return $html;   
        }
     

Modified: plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php
===================================================================
--- plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php  2010-02-02 
15:11:58 UTC (rev 27422)
+++ plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php  2010-02-02 
15:29:10 UTC (rev 27423)
@@ -32,8 +32,9 @@
                // The datagrid pager details
                $datagridPager = 
'%pager%&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;%grid_totals%',
                // The datagrid action bar
-               $datagridActions = '<table cellspacing="0" cellpadding="0" 
class="grid-actions"><tr><td valign="middle" class="left-actions"><span 
class="pager">%links%</span></td><td align="right" valign="middle" 
class="right-actions">%actions%</td></table>';
-               
+               $datagridActions = '<table cellspacing="0" cellpadding="0" 
class="grid-actions"><tr><td valign="middle" class="left-actions"><span 
class="pager">%links%</span></td><td align="right" valign="middle" 
class="right-actions">%actions%</td></table>',
+               // To check all for batch_actions
+               $datagridCheckAll= '<input type="checkbox" name="check_all" 
onchange="dg_check_all(this)" />';
        protected
                $P_ORDER = 'dg_order',
                $P_SORT = 'dg_sort',
@@ -261,7 +262,7 @@
                
                if(count($actions) != 0)
                {
-                       $htmlOutput.= content_tag('th', '&nbsp;', array('style' 
=> 'width: 30px;'));
+                       $htmlOutput.= content_tag('th', 
$this->datagridCheckAll, array('style' => 'width: 30px; text-align:center'));
                }
                
                foreach($columns as $key => $label)

Modified: plugins/sfDatagridPlugin/lib/sfDatagridPropel.class.php
===================================================================
--- plugins/sfDatagridPlugin/lib/sfDatagridPropel.class.php     2010-02-02 
15:11:58 UTC (rev 27422)
+++ plugins/sfDatagridPlugin/lib/sfDatagridPropel.class.php     2010-02-02 
15:29:10 UTC (rev 27423)
@@ -106,7 +106,7 @@
         */
        protected function getColumnType($column)
        {
-               if($column=='_object_actions'){
+               if(in_array($column,array('_object_actions','CHECK_ALL'))){
                        return 'NOTYPE';
                }
                if(array_key_exists($column, $this->columnsSort))
@@ -265,7 +265,7 @@
         * @return object The column sorting constant
         */
        protected function getColumnSortingOption($columnName)
-       {
+       {
                if(array_key_exists($columnName, $this->columnsSort) && 
$this->columnsSort[$columnName] != 'nosort')
                {
                        if(defined($this->columnsSort[$columnName]))
@@ -274,8 +274,8 @@
                } 
                else 
                {
-                       
-                       return constant($this->peerTable . $this->tableSuffix . 
'Peer::' . strtoupper($columnName));
+               
+           return constant($this->peerTable . $this->tableSuffix . 'Peer::' . 
strtoupper($columnName));
                }
        }
        

Modified: plugins/sfDatagridPlugin/web/js/datagrid.js
===================================================================
--- plugins/sfDatagridPlugin/web/js/datagrid.js 2010-02-02 15:11:58 UTC (rev 
27422)
+++ plugins/sfDatagridPlugin/web/js/datagrid.js 2010-02-02 15:29:10 UTC (rev 
27423)
@@ -42,7 +42,10 @@
     
     return false;
 }
-
+function dg_check_all(chk){
+    var checked_status = chk.checked;
+    alert('Non implémenté');
+}
 function dg_hide_show(name)
 {    
     if($('loader-' + name))

Modified: plugins/sfDatagridPlugin/web/js/jquery.datagrid.js
===================================================================
--- plugins/sfDatagridPlugin/web/js/jquery.datagrid.js  2010-02-02 15:11:58 UTC 
(rev 27422)
+++ plugins/sfDatagridPlugin/web/js/jquery.datagrid.js  2010-02-02 15:29:10 UTC 
(rev 27423)
@@ -53,6 +53,10 @@
     }
 }
 
+function dg_check_all(chk){
+    var checked_status = chk.checked;
+    
$(chk).parent().parent().parent().find("input.gridline_chk[type='checkbox']").attr('checked',checked_status);
+}
 function dg_keydown(form, datagridName, type, url, e)
 {
     if(e.keyCode == 13)

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to