Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Check all uncheck all support.

  • Loading branch information...
commit 65df73f6aa970d2d767316b8be89387d9dd0235b 1 parent 8d9f068
Tom Shaw authored
Showing with 14 additions and 7 deletions.
  1. +1 −1  application/views/scripts/grid.phtml
  2. +13 −6 public/js/gridola.js
View
2  application/views/scripts/grid.phtml
@@ -59,7 +59,7 @@
<tbody>
<?php if($this->showfilter): ?>
<tr>
- <?php if(sizeof($this->massactions)): ?><td style="text-align:center;"><input type="checkbox" id="checkall" value=""></td><?php endif; ?>
+ <?php if(sizeof($this->massactions)): ?><td style="text-align:center;"><input type="checkbox" id="checkall" name="checkall"></td><?php endif; ?>
<?php foreach($this->datagrid as $element): ?>
<td <?php echo $element['style'] ?>><?php echo $element['element']; ?></td>
<?php endforeach; ?>
View
19 public/js/gridola.js
@@ -44,8 +44,8 @@
Action.prototype = {
constructor: Action,
process: function () {
- var $el = this.$element,
- $jsonActions = this.$jsonActions;
+ var $el = this.$element
+ , $jsonActions = this.$jsonActions;
jQuery.each($jsonActions, function (key, val) {
if (key == $el.val()) {
$(gridolaFormId).attr('action', val.url);
@@ -57,8 +57,8 @@
$.fn.action = function (option) {
return this.each(function () {
- var $this = $(this),
- data = $this.data('action');
+ var $this = $(this)
+ , data = $this.data('action');
if (!this.$default) this.$default = $(gridolaFormId).attr("action");
$(gridolaFormId).attr('action', this.$default);
if (!data) $this.data('action', (data = new Action(this)));
@@ -83,12 +83,15 @@
* MIT Licensed
*/
-!function ($) {
+!
+function ($) {
"use strict";
var selector = 'tbody tr[data-href]',
namespace = 'click.table-row.data-api',
+ checkboxes = '#checkall',
+ checknamespace = 'click.checkall.data-api',
Row = function (element) {
this.checkboxes($(element).on(namespace, this.location));
};
@@ -104,8 +107,11 @@
$element.find('input').hover(function () {
$(this).parents('tr').unbind(namespace);
}).parents('tr').on(namespace, function () {
- this.location();
+ $(this).attr('data-href');
});
+ },
+ checkall: function () {
+ $(this).parents('table:eq(0)').find(':checkbox').attr('checked', this.checked);
}
};
@@ -121,6 +127,7 @@
$.fn.tablerow.Constructor = Row;
$(function () {
+ $('body').on(checknamespace, checkboxes, Row.prototype.checkall);
$(selector).each(function () {
var $this = $(this);
if ($this.data('tablerow')) return;
Please sign in to comment.
Something went wrong with that request. Please try again.