From bae55355a5a195646ae31083b4f0d03aa15aa095 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Tue, 27 Mar 2012 18:26:29 +0100 Subject: [PATCH] [#36,#39,demo/import][s]: import menu has working import from file (csv) (fixes #36, fixes #39). * First part of #39 (import menu) in 17986f25afdf9569c3e72a8ede0fb6df3cb703d9. --- demo/index.html | 24 ++++++++++++++++++++++++ demo/js/app.js | 11 +++++++++++ 2 files changed, 35 insertions(+) diff --git a/demo/index.html b/demo/index.html index 6548e7df..bfd45a5f 100644 --- a/demo/index.html +++ b/demo/index.html @@ -36,6 +36,7 @@ + @@ -60,6 +61,9 @@
  • Import from URL
  • +
  • + Import from File +
  • Read-only
  • @@ -98,6 +102,26 @@ + +
    diff --git a/demo/js/app.js b/demo/js/app.js index c0aa5cbb..9198a913 100755 --- a/demo/js/app.js +++ b/demo/js/app.js @@ -117,5 +117,16 @@ function setupLoader(callback) { ); callback(dataset); }); + + $('.js-import-dialog-file form').submit(function(e) { + e.preventDefault(); + var $form = $(e.target); + $('.modal.js-import-dialog-file').modal('hide'); + var $file = $form.find('input[type="file"]')[0]; + var file = $file.files[0]; + recline.Backend.loadFromCSVFile(file, function(dataset) { + callback(dataset) + }); + }); }