我上传了一些 SimpleTable 示例:
https://gist.github.com/1080278
现在,它可以编译,但是当我启动服务器时,我得到了:
File "stdlib/core/rpc/core/oparpc.opa", line 360, characters 12-123, (360:12-360:123 | 10511-10622)
@fail: Invalid distant call to function (_v0_create_stdlib.components.simpletable) at File "stdlib/core/rpc/core/oparpc.opa", line 360, characters 69-81, (360:69-360:81 | 10568-10580): there seems to be no client connected
Error: uncaught OPA exception {fail: $"Invalid distant call to function (_v0_create_stdlib.components.simpletable) at File \"stdlib/core/rpc...pa\", line 360, characters 69-81, (360:69-360:81 | 10568-10580): there seems to be no client connecte"$; position: $"File \"stdlib/core/rpc/core/oparpc.opa\", line 360, characters 12-123, (360:12-360:123 | 10511-10622)"$}
*** Stack trace:
Fatal error: exception Scheduler.Empty
有人可以帮我解释一下我们必须如何使用这个组件吗? 并且还通过向我解释我的示例中的错误内容......
PS:我将根据您的答案更正要点文件...然后采用要点的第一个修订版来查看错误文件,我希望要点的最后一个修订版很快就会成为一个很好的样本关于如何使用这个组件!
谢谢大家 future 的回答:)
最佳答案
函数 CSimpleTable.create 是仅限客户端的函数。因此,在顶层调用它是没有意义的,因为您还没有连接任何客户端。
我不知道为什么要这样设计,但这意味着客户端必须首先接收该页面,然后您可以将表格放入其中。 例如,只需替换文件末尾(以 table = ... 开头)即可解决问题:
onready(_) =
Dom.transform([#something <- CSimpleTable.generate_page(CSimpleTable.create(config, id, callbacks, rows, els, display), "test")])
server = Server.one_page_server("test", -> <div id=#something onready={onready}/>)
关于opa - 如何让 SimpleTable 组件工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6679653/