有关扩展GAS电子表格实用性的问题 [英] Questions on extending GAS spreadsheet usefulness

查看:148
本文介绍了有关扩展GAS电子表格实用性的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想借此机会在电子表格查看来自相同数据的输出. rel ="nofollow noreferrer"> TBA 侧边栏,最好是创建用于输出的另一种HTML窗口,例如,使用JavaScript库,例如三个. 我制作的非Google版本是一个带有iframe的网页,该iframe可以调整大小,拖动和打开/关闭,最重要的是,它们的内容在顶部窗口中共享相同的记录对象.因此,我相信,天真的,可以在此既定且流行的应用程序中将类似的选项作为选项. 至少,TBA试验向我展示了查看和操作 myjson 这样的存储库中)的工具协作工作对我特别有启发性.

我已经尝试过将侧边栏用于不同的HTML文件,但是事实上只有一个保持打开状态不是很有用,坦率地说,共享记录对象仍然超出了我的范围.所以这是主要问题. Google人们是否会考虑使用额外的窗口类型可能有点雄心勃勃,但我认为值得一问.

解决方案

window.open window.postMessage()解决了上述两个问题.

我希望您可以从屏幕截图和代码中放心,可以将Google表格的用途扩展到实现共同利益的目的.核心是两种用于输入,复制和查看文本数据的方法-电子表格以通过一组数据的切片,TBA用于在Trail(x轴)和Branchs(y轴)中的关联导航以及当前所选内容的各个方面(z轴)需要合作以引起不同兴趣的关注.

因此,例如,护士会发现TBA对于记录患者检查的许多方面都非常有用,而药剂师可能会发现电子表格对库存控制更有用.两者都将数据记录在一个我称为"nset"(命名集的层次结构)的通用对象中,并保存在云中并可以在协作活动中分发.

TBA对克隆大量记录也很有用.例如,一个带有家具的房间可以在一个楼层上复制,然后可以将带有房间的该楼层复制为一个完整的塔.

通过postMessage能够在多个监视器窗口中维护并行的nset对象,意味着无与伦比的机会以不同形式的多媒体显示相同的数据,包括交互式动画,增强现实,CNC机器指令,IOT控件...

这是相关代码:

在边栏中的TBA中:

 window.addEventListener("message", receiveMessage, false);

    function openMonitor(nset){
       var params = [
          'height=400',
          'width=400'
       ].join(',');
        let file = 'http://glasier.hk/blazer/model.html';
        popup = window.open(file,'popup_window', params); 
        popup.moveTo(100,100);
      }

    var popup;

    function receiveMessage(event) {
      let ed,nb;
      ed = event.data;
      nb = typeof ed === "string"? ed : nb[0];
      switch(nb){
        case "Post":
          console.log("Post");
          popup.postMessage(["Refreshing nset",nset], "http:glasier.hk"); 
          break;
        }
    }

        function importNset(){
          google.script.run
          .withSuccessHandler(function (code) {
           root = '1grsin';
           trial = 'msm4r';
           orig = 'ozs29';
           code = orig;
            path = "https://api.myjson.com/bins/"+code;
            $.get(path)
            .done((data, textStatus, jqXHR) => {
              nset = data;
              openMonitor(nset);
              cfig = nset.cfig;
              start();
              })
          })
          .sendCode();
        }

在弹出窗口中:

     $(document).ready(function(){
        name = $(window).attr("name");
        if(name === "workshop"){
          tgt = opener.location.href;
        }
        else{
          tgt = "https://n-rxnikgfd6bqtnglngjmbaz3j2p7cbcqce3dihry-0lu-script.googleusercontent.com"
        }
        $("#notice").html(tgt);
        opener.postMessage("Post",tgt);
        $(window).on("resize",function(){
          location.reload();
        })
      })
    }

    window.addEventListener("message", receiveMessage, false);

    function receiveMessage(event) {
      let ed,nb;
      ed = event.data;
      nb = typeof ed === "string"? ed : ed[0];
      switch(nb){
        case "Post": popup.postMessage(["nset" +nset], "*"); break;
        default :
        src = event.origin;
        notice = [ed[0]," from ",src ];
        console.log(notice);
       // $("#notice").html(notice).show();
        nset = ed[1];
        cfig = nset.cfig;
        reloader(src);
      }
    }

我应该解释,侧边栏的html部分是在localhost研讨会上构建的,所有样式和脚本都被编译到一个文件中,以粘贴到侧边栏的html文件中.该研讨会也可以在线获得. Google目标由postMessage中的event.origin提供.这将必须发布给希望制作不同监视器的任何人.现在,我刚刚使用Three.js制作了3D建模监视器.

我认为,在这里进行了大量研究和质疑之后,这应该是正确的答案.

I would like to offer the opportunity to view output from the same data, in a spreadsheet, TBA sidebar and, ideally another type of HTML window for output created, for example, with a JavaScript Library like THREE. The non Google version I made is a web page with iframes that can be resized, dragged and opened/closed and, most importantly, their content shares the same record object in the top window. So, I believe, perhaps naively, something similar could be made an option inside this established and popular application. At the very least, the TBA trial has shown me it useful to view and manipulate information from either sheet or TBA. The facility to navigate large building projects, clone rooms and floors, and combine JSON records (stored in depositories like myjson) for collaborative work is particularly inspiring for me.

I have tried using the sidebar for different HTML files, but the fact only one stays open is not very useful, and frankly, sharing record objects is still beyond me. So that is the main question. Whether Google people would consider an extra window type is probably a bit ambitious, but I think worth asking.

解决方案

window.open and window.postMessage() solved both the problems I described above.

I hope you will be assured from the screenshot and code that the usefulness of Google sheets can be extended for the common good. At the core is the two methods for inputting, copying and reviewing textual data - spreadsheet for a slice through a set of data, and TBA for navigation of associations in the Trail (x axis) and Branches (y axis), and for working on Aspects (z axis) of the current selection that require attention, in collaborations, from different interests.

So, for example, a nurse would find TBA useful for recording many aspects of an examination of a patient, whereas a pharmacist might find a spreadsheet more useful for stock control. Both record their data in a common object I call 'nset' (hierarchy of named sets), saved in the cloud and available for distribution in collaborative activities.

TBA is also useful for cloning large sets of records. For example, one room, complete with furniture can be replicated on one floor, then that floor, complete with rooms can be replicated for a complete tower.

Being able to maintain parallel nset objects in multiple monitor windows by postMessage means unrivalled opportunities to display the same data in different forms of multimedia, including interactive animation, augmented reality, CNC machine instruction, IOT controls ...

Here is the related code:

From the TBA in sidebar:

 window.addEventListener("message", receiveMessage, false);

    function openMonitor(nset){
       var params = [
          'height=400',
          'width=400'
       ].join(',');
        let file = 'http://glasier.hk/blazer/model.html';
        popup = window.open(file,'popup_window', params); 
        popup.moveTo(100,100);
      }

    var popup;

    function receiveMessage(event) {
      let ed,nb;
      ed = event.data;
      nb = typeof ed === "string"? ed : nb[0];
      switch(nb){
        case "Post":
          console.log("Post");
          popup.postMessage(["Refreshing nset",nset], "http:glasier.hk"); 
          break;
        }
    }

        function importNset(){
          google.script.run
          .withSuccessHandler(function (code) {
           root = '1grsin';
           trial = 'msm4r';
           orig = 'ozs29';
           code = orig;
            path = "https://api.myjson.com/bins/"+code;
            $.get(path)
            .done((data, textStatus, jqXHR) => {
              nset = data;
              openMonitor(nset);
              cfig = nset.cfig;
              start();
              })
          })
          .sendCode();
        }

From the popup window:

     $(document).ready(function(){
        name = $(window).attr("name");
        if(name === "workshop"){
          tgt = opener.location.href;
        }
        else{
          tgt = "https://n-rxnikgfd6bqtnglngjmbaz3j2p7cbcqce3dihry-0lu-script.googleusercontent.com"
        }
        $("#notice").html(tgt);
        opener.postMessage("Post",tgt);
        $(window).on("resize",function(){
          location.reload();
        })
      })
    }

    window.addEventListener("message", receiveMessage, false);

    function receiveMessage(event) {
      let ed,nb;
      ed = event.data;
      nb = typeof ed === "string"? ed : ed[0];
      switch(nb){
        case "Post": popup.postMessage(["nset" +nset], "*"); break;
        default :
        src = event.origin;
        notice = [ed[0]," from ",src ];
        console.log(notice);
       // $("#notice").html(notice).show();
        nset = ed[1];
        cfig = nset.cfig;
        reloader(src);
      }
    }

I should explain that the html part of the sidebar was built on a localhost workshop, with all styles and scripts compiled into a single file for pasting in a sidebar html file. The workshop also is available online. The Google target is provided by event.origin in postMessage. This would have to be issued to anyone wishing to make different monitors. For now I have just made the 3D modelling monitor with Three.js.

I think, after much research and questioning around here, this should be the proper answer.

这篇关于有关扩展GAS电子表格实用性的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆