How to get SimpleTable components working?
I have upload a little sample of SimpleTable :
https://gist.github.com/1080278
Now, it compile but when I launch the server, I get that :
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
Could someone help me, by explaining, how we must use this components ? And also by explaining me what's false in my example...
PS : I will correct the gist file, with your answer... Then take the first revision of the gist for seeing the false file, And I'm hopping the开发者_StackOverflow中文版 last revision of the gist will be very soon a great sample on how to use this components !
Thanks guys for your future answer :)
The function CSimpleTable.create is a client only function. So it makes no sense to call it at toplevel, since you don't have any client connected yet.
I don't know why things are designed that way, but it means that the client must first receive the page, and then you can put your table in it. For instance, simply replacing the end of your file (starting with table = ...) with this solves the problem:
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}/>)
精彩评论