I am having trouble creating a SashBox( or anything from the domkit) and than attaching it to the DOM in a Webserver. Does anyone have a really in depth example that illustrates how to accomplish this task.
andyMon 17 Oct 2016
We'll hopefully be adding lots of docs here soon. But a domkit node is just a normal HTML DOM element - so you can add it anywhere:
sash := SashBox
{
it.dir = Dir.right
it.sizes = ["40%", "60%"]
Box { it.text="Left Side" },
Box { it.text="Right Side" },
}
// add as main content
Win.cur.doc.body.add(sash)
// add under a specific node
Win.cur.doc.querySelector("div.foobar").add(sash)
But make sure you are actually loading domkit.css - you'll need that to get it working properly.
JohnNuccioTue 18 Oct 2016
I have a Wisp Web Server. And I am trying to modify the Out Stream. How do I use Win to modify my Out Stream with a Sash Box. Also I am using domkit.
Andy's code snippet is Fantom (Javascript) code that is meant to be run in the browser, after your HTML content has been delivered.
So your HTML first needs to be modified to include Fantom JS code from all the dependent pods. This little snippet shows something like what your HTML should look like:
JohnNuccio Mon 17 Oct 2016
I am having trouble creating a SashBox( or anything from the domkit) and than attaching it to the DOM in a Webserver. Does anyone have a really in depth example that illustrates how to accomplish this task.
andy Mon 17 Oct 2016
We'll hopefully be adding lots of docs here soon. But a domkit node is just a normal HTML DOM element - so you can add it anywhere:
But make sure you are actually loading
domkit.css
- you'll need that to get it working properly.JohnNuccio Tue 18 Oct 2016
I have a Wisp Web Server. And I am trying to modify the Out Stream. How do I use Win to modify my Out Stream with a Sash Box. Also I am using domkit.
sash := SashBox {
}
SlimerDude Tue 18 Oct 2016
Hi John,
Andy's code snippet is Fantom (Javascript) code that is meant to be run in the browser, after your HTML content has been delivered.
So your HTML first needs to be modified to include Fantom JS code from all the dependent pods. This little snippet shows something like what your HTML should look like:
http://eggbox.fantomfactory.org/pods/afDuvet/doc/#nonRequireJSUsage:
Your Wisp server then need to respond to, and serve up, the URLs listed above.
Personally, I find it all a lot of work, so if you're feeling brave you could try BedSheet and Duvet to do all this for you.
This article then guides you through running FWT in a browser: Run Fantom Code In a Browser!.
(Note I still need to update it for
domkit
.)JohnNuccio Tue 18 Oct 2016
This is the result in the browser.
But how do you write this in Fantom to get this result in the Browser?
SlimerDude Tue 18 Oct 2016
Anyway you want, it's just a HTML string!
Here's the simplest:
Or you could continue to use
WebOutStream
:JohnNuccio Wed 19 Oct 2016
I got the WebOutStream to load the SashBox, Thanks SlimerDude.
Also the HTML String version worked well too,but for anyone else wanting to try out the string example change the script to this.