Skip to content

Commit

Permalink
MDL-44416 Correct detail view paging
Browse files Browse the repository at this point in the history
  • Loading branch information
woolardfa committed Mar 13, 2014
1 parent c0e8812 commit 1c027ff
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions repository/filepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,6 @@ YUI.add('moodle-core_filepicker', function(Y) {
{key: "mimetype", label: M.str.repository.type, allowHTML: true,
sortable: true, sortFn: sortFoldersFirst}
];
for (var k in fileslist) {
// to speed up sorting and formatting
fileslist[k].displayname = file_get_displayname(fileslist[k]);
fileslist[k].isfolder = file_is_folder(fileslist[k]);
fileslist[k].classname = options.classnamecallback(fileslist[k]);
}
scope.tableview = new Y.DataTable({columns: cols, data: fileslist});
scope.tableview.delegate('click', function (e, tableview) {
var record = tableview.getRecord(e.currentTarget.get('id'));
Expand All @@ -366,8 +360,12 @@ YUI.add('moodle-core_filepicker', function(Y) {
}
/** append items in table view mode */
var append_files_table = function() {
var parentnode = scope.one('.'+classname);
scope.tableview.render(parentnode);
if (options.appendonly) {
fileslist.forEach(function(el) {
this.tableview.data.add(el);
},scope);
}
scope.tableview.render(scope.one('.'+classname));
scope.tableview.sortable = options.sortable ? true : false;
};
/** append items in tree view mode */
Expand Down Expand Up @@ -428,6 +426,16 @@ YUI.add('moodle-core_filepicker', function(Y) {
}
}

// If table view, need some additional properties
// before passing fileslist to the YUI tableview
if (options.viewmode == 3) {
fileslist.forEach(function(el) {
el.displayname = file_get_displayname(el);
el.isfolder = file_is_folder(el);
el.classname = options.classnamecallback(el);
}, scope);
}

// initialize files view
if (!options.appendonly) {
var parent = Y.Node.create('<div/>').addClass(classname);
Expand Down

0 comments on commit 1c027ff

Please sign in to comment.