Skip to content

Commit

Permalink
Added possibility to choose classes for search, sort, list
Browse files Browse the repository at this point in the history
  • Loading branch information
javve committed Oct 19, 2011
1 parent 2b82d24 commit 2fc57f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion list.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions src/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ function List(id, options, values) {
this.maxVisibleItemsCount = 200;

var init = function(values, options) {
if (typeof options.list === 'undefined') {
options.list = id;
}

options.list = options.list || id;
options.listClass = options.listClass || 'list';
options.searchClass = options.searchClass || 'search';
options.sortClass = options.sortClass || 'sort';

templater = new Templater(self, options);
self.list = ListJsHelpers.getByClass('list', self.listContainer, true);
ListJsHelpers.addEvent(ListJsHelpers.getByClass('search', self.listContainer), 'keyup', self.search);
ListJsHelpers.addEvent(ListJsHelpers.getByClass('sort', self.listContainer), 'click', self.sort);
self.list = ListJsHelpers.getByClass(options.listClass, self.listContainer, true);
ListJsHelpers.addEvent(ListJsHelpers.getByClass(options.searchClass, self.listContainer), 'keyup', self.search);
ListJsHelpers.addEvent(ListJsHelpers.getByClass(options.sortClass, self.listContainer), 'click', self.sort);
if (options.valueNames) {
var itemsToIndex = initialItems.get(),
valueNames = options.valueNames;
Expand Down Expand Up @@ -373,7 +376,7 @@ List.prototype.templateEngines = {};


List.prototype.templateEngines.standard = function(list, settings) {
var listSource = ListJsHelpers.getByClass('list', document.getElementById(settings.list))[0]
var listSource = ListJsHelpers.getByClass(settings.listClass, document.getElementById(settings.list))[0]
, itemSource = document.getElementById(settings.item)
, templater = this
, list = list;
Expand Down

0 comments on commit 2fc57f8

Please sign in to comment.