zoukankan      html  css  js  c++  java
  • spreadjs 自定义上传文件单元格

    function FileCellType() {

    }
    FileCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
    FileCellType.prototype.createEditorElement = function() {
    //Creates a DOM element then returns it.
    var button = document.createElement("input");
    return button;
    };
    FileCellType.prototype.getEditorValue = function(editorContext) {
    //Gets the editor's value.
    return $(editorContext).val();
    };
    FileCellType.prototype.setEditorValue = function(editorContext, value) {
    //Sets the editor's value.
    $(editorContext).val(value);
    };
    FileCellType.prototype.deactivateEditor = function(editorContext, context) {
    //Remove input editor when end editor status.
    if (editorContext) {
    var element = editorContext;
    }
    GC.Spread.Sheets.CellTypes.Base.prototype.deactivateEditor.apply(this, arguments);
    };
    FileCellType.prototype.activateEditor = function(editorContext, cellStyle, cellRect, context) {
    //Activates the editor, including setting properties or attributes for the editor and binding events for the editor.
    if (editorContext) {
    $editor = $(editorContext);
    var filecl = document.getElementById("file1");
    $editor.css("position", "absolute");
    $editor.attr("gcUIElement", "gcEditingInput");
    setTimeout(function() {
    if (filecl) {
    filecl.click();
    $("#file1").change(function() {
    var formdata = new FormData($("#uploadForm")[0]);
    $.ajax({
    url: "../Spread/files.ashx",
    type: "post",
    data: formdata,
    async: false,
    contentType: false,
    processData: false,
    success: function(data) {
    if(data!="请选择上传文件")
    {


    }
    },
    error: function(data) {
    alert("处理失败,请重试!");
    }
    });
    $('#file1').replaceWith('<input id="file1" name="fileupload" multiple="multiple" style="display:none;" type="file" value="" />');
    });
    }
    }
    $('#file1').replaceWith('<input id="file1" name="fileupload" multiple="multiple" style="display:none;" type="file" value="" />');
    });
    }
    }
    }
    }
    },
    200);
    }
    };
    FileCellType.prototype.updateEditor = function(editorContext, cellStyle, cellRect, context) {
    if (editorContext) {
    $editor = $(editorContext);
    $editor.css("width", cellRect.width - 1);
    $editor.css("height", cellRect.height - 3);
    }
    };
    //#endregion

    一般处理程序

  • 相关阅读:
    【IdentityServer4文档】- 使用密码保护 API
    【IdentityServer4文档】- 使用客户端凭据保护 API
    【IdentityServer4文档】- 启动和概览
    【IdentityServer4文档】- 术语&演示服务器和测试
    【IdentityServer4文档】- 支持和咨询选项
    【IdentityServer4文档】- 支持协议
    【IdentityServer4文档】- 打包和构建
    【IdentityServer4文档】- 贡献
    QLGame 2d Engine源码地址
    QLGame 2d Engine 搭建2d游戏原理
  • 原文地址:https://www.cnblogs.com/yeyuqian/p/10750255.html
Copyright © 2011-2022 走看看