Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Works with latest Steal

  • Loading branch information...
commit b25f83bdb1053ea6db748ea37a66f7fddd892755 1 parent 86e7580
@daffl daffl authored
Showing with 20 additions and 17 deletions.
  1. +7 −13 grid/grid.js
  2. +12 −3 list/list.js
  3. +1 −1  util/scrollbar_width.js
View
20 grid/grid.js
@@ -93,7 +93,7 @@ steal('jquery', 'can/control', 'canui/list', 'can/view/ejs', 'canui/table_scroll
current = can.view.frag(current);
- // TODO maybe make an option
+ // TODO maybe make an option, what if it is not a TD?
if(wrap && !can.$(current).is('td')) {
current = can.$('<td colspan="' + self.options.columns.length
+ '"></td>').html(current);
@@ -149,20 +149,14 @@ steal('jquery', 'can/control', 'canui/list', 'can/view/ejs', 'canui/table_scroll
}
},
- items : function() {
- return this.control.list.items.apply(this.control.list, arguments);
- },
-
- list : function() {
- return this.control.list.list.apply(this.control.list, arguments);
- },
-
- rowElements : function() {
- return this.control.list.rowElements.apply(this.control.list, arguments);
- },
-
tableScroll : function() {
return this.control.tableScroll;
}
});
+
+ can.each(['items', 'list', 'rowElements'], function(name) {
+ can.ui.Grid.prototype[name] = function() {
+ return this.control.list[name].apply(this.control.list, arguments);
+ }
+ });
});
View
15 list/list.js
@@ -13,9 +13,14 @@ function($) {
},
/**
- * Updates the options and re-renders the list.
+ * Updates the options and re-renders the list. Will also be called
+ * by subsequent calls to `$(element).list([options])`.
*
- * @param {Object} [options] The options to udpate
+ * $('#list').list({ view : '<li><%= this.attr("name") %></li>' });
+ * //
+ * $('#list').list({ list : [{ name : 'Test' }] });
+ *
+ * @param {Object} [options] The options to update
*/
update : function(options) {
can.Control.prototype.update.call(this, options);
@@ -140,7 +145,11 @@ function($) {
},
/**
- * Returns all rows or all rows representing the given list of observables.
+ * Returns a jQuery collection of all rows or all rows for the given observables:
+ *
+ * // Retrieves the row element for the first observe
+ * $('#list').list('rowElements', people[0]);
+ * // -> [<li data-cid="...">John</li>]
*
* @param arg
* @return {*}
View
2  util/scrollbar_width.js
@@ -1,4 +1,4 @@
-steal('jquery').then(function ($) {
+steal('jquery', function () {
window.can || (window.can = {});
window.can.ui || (window.can.ui = {});
Please sign in to comment.
Something went wrong with that request. Please try again.