fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [14696] row select with checkbox


From: Sigurd Nes
Subject: [Fmsystem-commits] [14696] row select with checkbox
Date: Thu, 04 Feb 2016 15:01:02 +0000

Revision: 14696
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14696
Author:   sigurdne
Date:     2016-02-04 15:01:01 +0000 (Thu, 04 Feb 2016)
Log Message:
-----------
row select with checkbox

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/js/jquery/common.js
    branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl

Modified: branches/dev-syncromind/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/common.js        2016-02-04 
12:59:07 UTC (rev 14695)
+++ branches/dev-syncromind/phpgwapi/js/jquery/common.js        2016-02-04 
15:01:01 UTC (rev 14696)
@@ -222,7 +222,6 @@
 
        data = data || {};
 
-//     if (Object.keys(data).length == 0)
        if (ajax_url)
        {
                var ajax_def = {url: ajax_url, data: {}, type: 'GET'};
@@ -237,7 +236,9 @@
        {
                var sDom_def = 'B<"clear">lfrtip';
 //             var sDom_def = 'Bfrtlip';
+               var sDom_def = '<lfB<t>ip>'
                select = true;
+               select = {style:'multi'};
        }
        else
        {
@@ -309,6 +310,21 @@
                        var api = oTable.api();
                        var selectedRows = api.rows( { selected: true } 
).count();
                        api.buttons( '.record' ).enable( selectedRows > 0 );
+
+                       var row = $(this);
+                       var checkbox = row.find('input[type="checkbox"]');
+
+                       if(checkbox)
+                       {
+                               if($(this).hasClass('selected'))
+                               {
+                                       checkbox.prop("checked", true);
+                               }
+                               else
+                               {
+                                       checkbox.prop("checked", false);
+                               }
+                       }
         } );
 
 

Modified: branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl        
2016-02-04 12:59:07 UTC (rev 14695)
+++ branches/dev-syncromind/phpgwapi/templates/base/datatable_jquery.xsl        
2016-02-04 15:01:01 UTC (rev 14696)
@@ -587,31 +587,29 @@
                                {
                                text: "<xsl:value-of 
select="php:function('lang', 'select all')"/>",
                                action: function () {
-                               var api = oTable.api();
-                               api.rows().select();
-                               $(".mychecks").each(function()
-                               {
-                               $(this).prop("checked", true);
-                               });
-                               }
+                                               var api = oTable.api();
+                                               api.rows().select();
+                                               $(".mychecks").each(function()
+                                               {
+                                                       $(this).prop("checked", 
true);
+                                               });
+                                       }
                                },
                                {
                                text: "<xsl:value-of 
select="php:function('lang', 'select none')"/>",
                                action: function () {
-                               var api = oTable.api();
-                               api.rows().deselect();
-                               $(".mychecks").each(function()
-                               {
-                               $(this).prop("checked", false);
-                               });
-                               }
+                                               var api = oTable.api();
+                                               api.rows().deselect();
+                                               $(".mychecks").each(function()
+                                               {
+                                                       $(this).prop("checked", 
false);
+                                               });
+                                       }
                                },
                                'copyFlash',
                                'csvFlash',
                                'excelFlash',
                                'pdfFlash'
-
-
                                <xsl:choose>
                                        <xsl:when test="download">
                                                ,{
@@ -902,10 +900,6 @@
                                                lengthMenu: 
JqueryPortico.i18n.lengthmenu(),
                                                language: 
JqueryPortico.i18n.datatable(),
                                                columns: JqueryPortico.columns,
-//                                             colVis: {
-//                                                     exclude: exclude_colvis,
-//                                                      "buttonText": 
lang_ButtonText_columns
-//                                             },
                                                dom: sDom_def,
                                                stateSave: true,
                                                stateDuration: -1, 
//sessionstorage
@@ -914,9 +908,23 @@
                                        });
 
                                        $('#datatable-container tbody').on( 
'click', 'tr', function () {
-                                                       var api = oTable.api();
+                                               var api = oTable.api();
                                                        var selectedRows = 
api.rows( { selected: true } ).count();
                                                        api.buttons( '.record' 
).enable( selectedRows > 0 );
+                                                       var row = $(this);
+                                                       var checkbox = 
row.find('input[type="checkbox"]');
+
+                                                       if(checkbox)
+                                                       {
+                                                               
if($(this).hasClass('selected'))
+                                                               {
+                                                                       
checkbox.prop("checked", true);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
checkbox.prop("checked", false);
+                                                               }
+                                                       }
                                           } );
                                });
                        ]]>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]