node-webkit File Dialog

1. 多次选择相同的路径时,chooser.onchange 事件不触发

参考链接

Choosing the same directory multiple times

Once the chooser has been used to select a directory (or the same file path + file name), the change event will not fire again since the value of the input is already set with the same value. For example, if a user is expected to select a directory to export a file to, if they choose the same directory multiple times, the change event will one fire once. This is only an issue if the selected value may potentially be the same multiple times, i.e. in the case of selecting an output directory.

In this case, re-setting the value of the input can ensure that the change event will always fire in subsequent selections.

jQuery

<script>
  function chooseFile(name) {
    var chooser = $(name);
    chooser.change(function(evt) {
      console.log($(this).val());
      // Reset the selected value to empty (‘‘)
      $(this).val(‘‘);
    });

    chooser.trigger(‘click‘);
  }
  chooseFile(‘#fileDialog‘);
</script>

 
时间: 2024-10-12 14:04:02

node-webkit File Dialog的相关文章

Inaccurate values for &ldquo;Currently allocated space&rdquo; and &ldquo;Available free space&rdquo; in the Shrink File dialog for TEMPDB only

转载自:http://blogs.msdn.com/b/ialonso/archive/2012/10/08/inaccurate-values-for-currently-allocated-space-and-available-free-space-in-the-shrink-file-dialog-for-tempdb-only.aspx   Inaccurate values for "Currently allocated space" and "Availabl

Using Open File Dialog in WPF

1 // Create OpenFileDialog 2 Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); 3 4 // Set filter for file extension and default file extension 5 dlg.DefaultExt = ".txt"; 6 dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PN

node webkit (nw.js) 无法调试的结局方案之一

项目,当时主要内容是由别人做的!过后回到家中,自己研究了下这方面.结果发现我的 nw 客户端不可以调试!在网上各种找办法,没找到,深感绝望,突然看到 (https://github.com/nwjs/nw.js/blob/nw17/docs/For%20Users/Getting%20Started.md) 上面说,建议你选择 sdk 版本! nw.js sdk 版本什么东西?抱着试一试的心态下了一个! 熟悉的界面又回来了!

node webkit(nw.js) 设置自动更新

原理:把更新的文件放在服务器上,设置一个客户端版本号,通过接口获取服务器上的版本,如果高于本地的版本就下载服务器上的代码,低于或等于就不更新 代码如下: <script> var http = require('http'); var fs = require('fs'); var request = require('request'); var unzip = require('unzip2'); var Driver = function () { this.timer = ''; th

Node webkit启动最大化窗口

<!DOCTYPE html> <html> <head>     </head> <body>     <p style="text-align:center;margin-top:10%;color:green;font-weight:bold;font-size:12px">正在加载中...</p>     <script language="javascript" ty

node.js File System(文件系统模块)

文件系统模块概述 该模块是核心模块,提供了操作文件的一些API,需要使用require导入后使用,通过 require('fs') 使用该模块 文件 I/O 是由简单封装的标准 POSIX 函数提供的 . 所有的方法都有异步和同步的形式. 异步形式始终以完成回调作为它最后一个参数.传给完成回调的参数取决于具体方法,但第一个参数总是留给异常. 如果操作成功完成,则第一个参数会是 null 或 undefined. 当使用同步形式时,任何异常都会被立即抛出. 可以使用 try/catch 来处理异常

How to Change Default Location for Outlook Data File (PST &amp; OST)

Is there a way to change the default location of new .pst file when create a new e-mail account in Outlook? Different versions of Outlook use different default locations to store pst files. In this tutorial we'll show you how to change default locati

node的fs模块

node的file system模块提供的api有同步和异步两种模式(大多数情况下都是用的异步方法,毕竟异步是node的特色,至于提供同步方法,可能应用程序复杂的时候有些场景使用同步会比较合适).异步方法里回调函数的第一个参数往往是个err对象,最后一个参数是返回的操作结果. node里面有很多模块,不少模块里面又有很多api,没必要短时间内一个个读完,因此只需要记住每个模块中最常用的一些api就好了. *在使用同步模式的api时,error是即时抛出的,因此同步方法最好放在一个try{}cat

DFS(distributed file system)

A clustered file system is a file system which is shared by being simultaneously mounted on multiple servers. There are several approaches to clustering, most of which do not employ a clustered file system (only direct attached storage for each node)