diff --git a/build/KoGrid.debug.js b/build/KoGrid.debug.js
index 32a16b38..0f5d315c 100644
--- a/build/KoGrid.debug.js
+++ b/build/KoGrid.debug.js
@@ -2,7 +2,7 @@
* koGrid JavaScript Library
* Authors: https://github.com/ericmbarnard/koGrid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
-* Compiled At: 01/11/2013 15:58:36
+* Compiled At: 03/29/2013 14:29:44
***********************************************/
(function (window) {
@@ -198,7 +198,7 @@ $.extend(window.kg.utils, {
/***********************************************
* FILE: ..\src\templates\gridTemplate.html
***********************************************/
-window.kg.defaultGridTemplate = function(){ return '
Drag a column header here and drop it to group by that column
';};
+window.kg.defaultGridTemplate = function(){ return 'Drag a column header here and drop it to group by that column
';};
/***********************************************
* FILE: ..\src\templates\rowTemplate.html
@@ -220,6 +220,11 @@ window.kg.aggregateTemplate = function(){ return '';};
+/***********************************************
+* FILE: ..\src\templates\footerRowTemplate.html
+***********************************************/
+window.kg.defaultFooterRowTemplate = function(){ return '';};
+
/***********************************************
* FILE: ..\src\templates\headerCellTemplate.html
***********************************************/
@@ -356,6 +361,30 @@ ko.bindingHandlers['kgHeaderRow'] = (function () {
};
}());
+/***********************************************
+* FILE: ..\src\bindingHandlers\kg-footer-row.js
+***********************************************/
+ko.bindingHandlers['kgFooterRow'] = (function () {
+ return {
+ 'init': function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
+ bindingContext.$userViewModel = bindingContext.$data.$userViewModel;
+ var compile = function(html) {
+ var footer = $(html);
+ ko.applyBindings(bindingContext, footer[0]);
+ $(element).html(footer);
+ };
+ if (viewModel.footerRowTemplate.then) {
+ viewModel.footerRowTemplate.then(function (p) {
+ compile(p);
+ });
+ } else {
+ compile(viewModel.footerRowTemplate);
+ }
+ return { controlsDescendantBindings: true };
+ }
+ };
+}());
+
/***********************************************
* FILE: ..\src\bindingHandlers\kg-header-cell.js
***********************************************/
@@ -484,6 +513,7 @@ window.kg.Column = function (config, grid) {
delay = 500,
clicks = 0,
timer = null;
+ self.config = config;
self.eventTaget = undefined;
self.width = colDef.width;
self.groupIndex = ko.observable(0);
@@ -1110,6 +1140,7 @@ window.kg.Grid = function (options) {
columnsChanged: function() { },
rowTemplate: undefined,
headerRowTemplate: undefined,
+ footerRowTemplate: undefined,
jqueryUITheme: false,
jqueryUIDraggable: false,
plugins: [],
@@ -1455,12 +1486,16 @@ window.kg.Grid = function (options) {
//Templates
self.rowTemplate = self.config.rowTemplate || window.kg.defaultRowTemplate();
self.headerRowTemplate = self.config.headerRowTemplate || window.kg.defaultHeaderRowTemplate();
+ self.footerRowTemplate = self.config.footerRowTemplate || window.kg.defaultFooterRowTemplate();
if (self.config.rowTemplate && !TEMPLATE_REGEXP.test(self.config.rowTemplate)) {
self.rowTemplate = window.kg.utils.getTemplatePromise(self.config.rowTemplate);
}
if (self.config.headerRowTemplate && !TEMPLATE_REGEXP.test(self.config.headerRowTemplate)) {
self.headerRowTemplate = window.kg.utils.getTemplatePromise(self.config.headerRowTemplate);
}
+ if (self.config.footerRowTemplate && !TEMPLATE_REGEXP.test(self.config.footerRowTemplate)) {
+ self.footerRowTemplate = window.kg.utils.getTemplatePromise(self.config.footerRowTemplate);
+ }
//scope funcs
self.visibleColumns = ko.computed(function () {
var cols = self.columns();
@@ -1587,7 +1622,7 @@ window.kg.Grid = function (options) {
var curPage = self.config.pagingOptions.currentPage();
return !(curPage > 1);
});
- //call init
+ //call init
self.init();
};
diff --git a/build/build-order.txt b/build/build-order.txt
index 39c5d881..5577e546 100644
--- a/build/build-order.txt
+++ b/build/build-order.txt
@@ -7,11 +7,13 @@
..\src\templates\cellTemplate.html
..\src\templates\aggregateTemplate.html
..\src\templates\headerRowTemplate.html
+..\src\templates\footerRowTemplate.html
..\src\templates\headerCellTemplate.html
..\src\bindingHandlers\ko-grid.js
..\src\bindingHandlers\kg-row.js
..\src\bindingHandlers\kg-cell.js
..\src\bindingHandlers\kg-header-row.js
+..\src\bindingHandlers\kg-footer-row.js
..\src\bindingHandlers\kg-header-cell.js
..\src\bindingHandlers\kg-mouse-events.js
..\src\classes\aggregate.js
diff --git a/koGrid-2.1.1.debug.js b/koGrid-2.1.1.debug.js
index 32a16b38..0f5d315c 100644
--- a/koGrid-2.1.1.debug.js
+++ b/koGrid-2.1.1.debug.js
@@ -2,7 +2,7 @@
* koGrid JavaScript Library
* Authors: https://github.com/ericmbarnard/koGrid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
-* Compiled At: 01/11/2013 15:58:36
+* Compiled At: 03/29/2013 14:29:44
***********************************************/
(function (window) {
@@ -198,7 +198,7 @@ $.extend(window.kg.utils, {
/***********************************************
* FILE: ..\src\templates\gridTemplate.html
***********************************************/
-window.kg.defaultGridTemplate = function(){ return 'Drag a column header here and drop it to group by that column
';};
+window.kg.defaultGridTemplate = function(){ return 'Drag a column header here and drop it to group by that column
';};
/***********************************************
* FILE: ..\src\templates\rowTemplate.html
@@ -220,6 +220,11 @@ window.kg.aggregateTemplate = function(){ return '';};
+/***********************************************
+* FILE: ..\src\templates\footerRowTemplate.html
+***********************************************/
+window.kg.defaultFooterRowTemplate = function(){ return '';};
+
/***********************************************
* FILE: ..\src\templates\headerCellTemplate.html
***********************************************/
@@ -356,6 +361,30 @@ ko.bindingHandlers['kgHeaderRow'] = (function () {
};
}());
+/***********************************************
+* FILE: ..\src\bindingHandlers\kg-footer-row.js
+***********************************************/
+ko.bindingHandlers['kgFooterRow'] = (function () {
+ return {
+ 'init': function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
+ bindingContext.$userViewModel = bindingContext.$data.$userViewModel;
+ var compile = function(html) {
+ var footer = $(html);
+ ko.applyBindings(bindingContext, footer[0]);
+ $(element).html(footer);
+ };
+ if (viewModel.footerRowTemplate.then) {
+ viewModel.footerRowTemplate.then(function (p) {
+ compile(p);
+ });
+ } else {
+ compile(viewModel.footerRowTemplate);
+ }
+ return { controlsDescendantBindings: true };
+ }
+ };
+}());
+
/***********************************************
* FILE: ..\src\bindingHandlers\kg-header-cell.js
***********************************************/
@@ -484,6 +513,7 @@ window.kg.Column = function (config, grid) {
delay = 500,
clicks = 0,
timer = null;
+ self.config = config;
self.eventTaget = undefined;
self.width = colDef.width;
self.groupIndex = ko.observable(0);
@@ -1110,6 +1140,7 @@ window.kg.Grid = function (options) {
columnsChanged: function() { },
rowTemplate: undefined,
headerRowTemplate: undefined,
+ footerRowTemplate: undefined,
jqueryUITheme: false,
jqueryUIDraggable: false,
plugins: [],
@@ -1455,12 +1486,16 @@ window.kg.Grid = function (options) {
//Templates
self.rowTemplate = self.config.rowTemplate || window.kg.defaultRowTemplate();
self.headerRowTemplate = self.config.headerRowTemplate || window.kg.defaultHeaderRowTemplate();
+ self.footerRowTemplate = self.config.footerRowTemplate || window.kg.defaultFooterRowTemplate();
if (self.config.rowTemplate && !TEMPLATE_REGEXP.test(self.config.rowTemplate)) {
self.rowTemplate = window.kg.utils.getTemplatePromise(self.config.rowTemplate);
}
if (self.config.headerRowTemplate && !TEMPLATE_REGEXP.test(self.config.headerRowTemplate)) {
self.headerRowTemplate = window.kg.utils.getTemplatePromise(self.config.headerRowTemplate);
}
+ if (self.config.footerRowTemplate && !TEMPLATE_REGEXP.test(self.config.footerRowTemplate)) {
+ self.footerRowTemplate = window.kg.utils.getTemplatePromise(self.config.footerRowTemplate);
+ }
//scope funcs
self.visibleColumns = ko.computed(function () {
var cols = self.columns();
@@ -1587,7 +1622,7 @@ window.kg.Grid = function (options) {
var curPage = self.config.pagingOptions.currentPage();
return !(curPage > 1);
});
- //call init
+ //call init
self.init();
};
diff --git a/src/bindingHandlers/kg-footer-row.js b/src/bindingHandlers/kg-footer-row.js
new file mode 100644
index 00000000..7bea9f91
--- /dev/null
+++ b/src/bindingHandlers/kg-footer-row.js
@@ -0,0 +1,20 @@
+ko.bindingHandlers['kgFooterRow'] = (function () {
+ return {
+ 'init': function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
+ bindingContext.$userViewModel = bindingContext.$data.$userViewModel;
+ var compile = function(html) {
+ var footer = $(html);
+ ko.applyBindings(bindingContext, footer[0]);
+ $(element).html(footer);
+ };
+ if (viewModel.footerRowTemplate.then) {
+ viewModel.footerRowTemplate.then(function (p) {
+ compile(p);
+ });
+ } else {
+ compile(viewModel.footerRowTemplate);
+ }
+ return { controlsDescendantBindings: true };
+ }
+ };
+}());
\ No newline at end of file
diff --git a/src/classes/column.js b/src/classes/column.js
index 9d3e1dd9..690c0da2 100644
--- a/src/classes/column.js
+++ b/src/classes/column.js
@@ -4,6 +4,7 @@
delay = 500,
clicks = 0,
timer = null;
+ self.config = config;
self.eventTaget = undefined;
self.width = colDef.width;
self.groupIndex = ko.observable(0);
diff --git a/src/classes/grid.js b/src/classes/grid.js
index 3a0dd241..6b1514a4 100644
--- a/src/classes/grid.js
+++ b/src/classes/grid.js
@@ -34,6 +34,7 @@ window.kg.Grid = function (options) {
columnsChanged: function() { },
rowTemplate: undefined,
headerRowTemplate: undefined,
+ footerRowTemplate: undefined,
jqueryUITheme: false,
jqueryUIDraggable: false,
plugins: [],
@@ -379,12 +380,16 @@ window.kg.Grid = function (options) {
//Templates
self.rowTemplate = self.config.rowTemplate || window.kg.defaultRowTemplate();
self.headerRowTemplate = self.config.headerRowTemplate || window.kg.defaultHeaderRowTemplate();
+ self.footerRowTemplate = self.config.footerRowTemplate || window.kg.defaultFooterRowTemplate();
if (self.config.rowTemplate && !TEMPLATE_REGEXP.test(self.config.rowTemplate)) {
self.rowTemplate = window.kg.utils.getTemplatePromise(self.config.rowTemplate);
}
if (self.config.headerRowTemplate && !TEMPLATE_REGEXP.test(self.config.headerRowTemplate)) {
self.headerRowTemplate = window.kg.utils.getTemplatePromise(self.config.headerRowTemplate);
}
+ if (self.config.footerRowTemplate && !TEMPLATE_REGEXP.test(self.config.footerRowTemplate)) {
+ self.footerRowTemplate = window.kg.utils.getTemplatePromise(self.config.footerRowTemplate);
+ }
//scope funcs
self.visibleColumns = ko.computed(function () {
var cols = self.columns();
@@ -511,6 +516,6 @@ window.kg.Grid = function (options) {
var curPage = self.config.pagingOptions.currentPage();
return !(curPage > 1);
});
- //call init
+ //call init
self.init();
};
\ No newline at end of file
diff --git a/src/templates/footerRowTemplate.html b/src/templates/footerRowTemplate.html
new file mode 100644
index 00000000..c3af0746
--- /dev/null
+++ b/src/templates/footerRowTemplate.html
@@ -0,0 +1,24 @@
+
+
\ No newline at end of file
diff --git a/src/templates/gridTemplate.html b/src/templates/gridTemplate.html
index 14b0267c..482beddf 100644
--- a/src/templates/gridTemplate.html
+++ b/src/templates/gridTemplate.html
@@ -47,27 +47,7 @@
-
\ No newline at end of file