Merge branch 'MDL-36548_23' of git://github.com/pauln/moodle into MOODLE_23_STABLE
authorDan Poltawski <dan@moodle.com>
Tue, 20 Nov 2012 06:45:04 +0000 (14:45 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 20 Nov 2012 06:45:04 +0000 (14:45 +0800)
1  2 
repository/filepicker.js

diff --combined repository/filepicker.js
@@@ -321,7 -321,6 +321,6 @@@ YUI.add('moodle-core_filepicker', funct
          }
          /** initialize table view */
          var initialize_table_view = function() {
-             var parentid = scope.one('.'+classname).get('id');
              var cols = [
                  {key: "displayname", label: M.str.moodle.name, allowHTML: true, formatter: formatTitle,
                      sortable: true, sortFn: sortFoldersFirst},
                  {key: "mimetype", label: M.str.repository.type, allowHTML: true,
                      sortable: true, sortFn: sortFoldersFirst}
              ];
-             scope.tableview = new Y.DataTable({columns: cols});
-             scope.tableview.render('#'+parentid);
+             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'));
                  if (record) {
          }
          /** append items in table view mode */
          var append_files_table = function() {
-             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.addRows(fileslist);
+             var parentnode = scope.one('.'+classname);
+             scope.tableview.render(parentnode);
              scope.tableview.sortable = options.sortable ? true : false;
          };
          /** append items in tree view mode */
@@@ -1024,7 -1023,7 +1023,7 @@@ M.core_filepicker.init = function(Y, op
              var nextpage = this.active_repo.page+1;
              var args = {
                  page: nextpage,
 -                repo_id: this.active_repo.id,
 +                repo_id: this.active_repo.id
              };
              var action = this.active_repo.issearchresult ? 'search' : 'list';
              this.request({