Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Bugfix for repeater list extension returning wrong rowData object in rowRenderer callback. #1077

Merged
merged 1 commit into from
Feb 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/repeater-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
this.viewOptions.list_rowRendered({
container: $tbody,
item: $row,
rowData: data
rowData: data.items[index]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified to just subset[index] I was already passing in the correct "items" array as the subset arg, I just mistakingly put the wrong argument there >.<

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what even is subset? That variable name needs to change...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These docs will change soon, but: http://getfuelux.com/extensions.html#writing-extensions-repeater-helpers

It's the "subset" of information that is being iterated over. In this case, data.items. renderRow is called passing the helpers.subset value as the subset argument. I suppose it could be renamed "items" in the scope of the renderRow function...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any case where it isn't just a convenience accessor for the data.items param?

}, function () {});
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/repeater-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ define(function(require){
if(!hasCalled.column){
ok(1===1, 'columnRendered callback called upon rendering column');
equal((helpers.container.length>0 && helpers.item.length>0), true, 'columnRendered helpers object contains appropriate attributes');
equal((helpers.rowData instanceof Array), false, 'rowRendered rowData is an object');
equal((typeof helpers.rowData.appearance), 'string', 'rowRendered rowData is an item from the dataSource');
hasCalled.column = true;
}
num.cols++;
Expand All @@ -137,6 +139,8 @@ define(function(require){
list_rowRendered: function(helpers, callback){
if(!hasCalled.row){
ok(1===1, 'rowRendered callback called upon rendering column');
equal((helpers.rowData instanceof Array), false, 'rowRendered rowData is an object');
equal((typeof helpers.rowData.appearance), 'string', 'rowRendered rowData is an item from the dataSource');
equal((helpers.container.length>0 && helpers.item.length>0), true, 'rowRendered helpers object contains appropriate attributes');
hasCalled.row = true;
}
Expand Down