Permalink
Browse files

Integrated entry click handling into library.

  • Loading branch information...
1 parent 65d76a7 commit 88b4e25171438b523315b33c382bdd40e491a1e5 @mcantelon committed Jul 9, 2012
Showing with 19 additions and 12 deletions.
  1. +17 −0 demo/demo4.js
  2. +2 −12 demo4.html
View
@@ -53,6 +53,23 @@ function demo() {
levelTemplate: $('#template-dir-level').html(),
entryTemplate: $('#template-dir-entry').html(),
closeDirsByDefault: false,
+ entryClickHandler: function(event) {
+ var explorer = event.data.self.explorer
+ , explorerId = explorer.id
+ , entryEl = this
+ , entryId = $(this).attr('id');
+
+ $('#' + explorerId).find('.backbone-file-explorer-entry').click(function() {
+ // take note of selected entry
+ explorer.selectedEntryId = $(entryEl).attr('id');
+
+ // remove highlighting of existing entries
+ $('#' + explorerId).find('.backbone-file-explorer-entry').css('border', '');
+
+ // highlight selected entry
+ $(entryEl).css('border', '1px solid blue');
+ });
+ },
nameClickHandler: function(result) {
fileExplorer.busy();
$('#message').text(
View
@@ -35,20 +35,10 @@
var selectedEntryId;
fileExplorer = demo();
- $('#explorer').find('.backbone-file-explorer-entry').click(function() {
- // take note of selected entry
- selectedEntryId = $(this).attr('id');
-
- // remove highlighting of existing entries
- $('#explorer').find('.backbone-file-explorer-entry').css('border', '');
-
- // highlight selected entry
- $(this).css('border', '1px solid blue');
- });
$('#explorer_delete_button').click(function() {
- var path = fileExplorer.getPathForCssId(selectedEntryId)
- , type = fileExplorer.getTypeForCssId(selectedEntryId);
+ var path = fileExplorer.getPathForCssId(fileExplorer.selectedEntryId)
+ , type = fileExplorer.getTypeForCssId(fileExplorer.selectedEntryId);
fileExplorer.busy();
$('#message').text(

0 comments on commit 88b4e25

Please sign in to comment.