2

我上传了一个 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:我会用你的答案更正 gist 文件...然后拿 gist 的第一个修订版来查看虚假文件,我希望 gist 的最后一个修订版很快就会成为一个很好的示例使用这个组件!

谢谢你们未来的回答:)

4

1 回答 1

3

函数 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}/>)
于 2011-07-13T13:42:22.577 回答