【问题标题】:Disable multiple file select in elFinder在 elFinder 中禁用多个文件选择
【发布时间】:2015-06-22 19:33:32
【问题描述】:

我们将 elFinder 用于我们的软件,同时也使用它的文件选择器。

这是(实际工作的)代码:

var elfinderInstance = modalBody.elfinder({
    lang: 'de',
    [...],
    getFileCallback: function(data) {
        $("#" + fileInputId).val(data.url);
        fileModal.modal("hide");
    },
    handlers : {
        select : function(event, elfinderInstance) {
            console.log(event.data.selected);
            var selected = event.data.selected;

            if (selected.length) {
                selectedElement = elfinderInstance.url(selected[0]);
            }
        }
    }
}).elfinder('instance');

但是,可以在模式中选择多个文件,只需按下 CTRL 按钮并单击多个文件。

如何禁用此行为?

我已经检查了选择处理程序,并且 selected.length 已经返回了所选文件的数量,但我不知道如何取消选择以前选择的文件,以便只能选择一个文件。我在文档中也没有找到任何东西 (https://github.com/Studio-42/elFinder/wiki)。

【问题讨论】:

    标签: javascript jquery elfinder


    【解决方案1】:

    对于 elFInder 2.1.17 或更高版本,连接器主选项 maxTargets 可用。这是抑制连接器侧负载的选项,但在这种情况下也有效。

    $opts = array(
        'maxTargets' => 1,
        'roots' => array( .... ),
    );
    

    https://github.com/Studio-42/elFinder/issues/2334

    【讨论】:

      猜你喜欢
      • 2016-06-27
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 1970-01-01
      • 2010-10-23
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      相关资源
      最近更新 更多