Generate dynamic Ajax controls from intuitive declarative templates.
1. Design your template (click to edit).
For more JBST syntax details, see: http://starterkit.jsonfx.net/jbst
2. Compile to JavaScript.
This produces a JavaScript object which can easily be bound to data e.g. Foo.MyZebraList.bind(data);.
3. Download the JBST runtime.
This is the only additional script needed to dynamically bind your control in the browser. It is only needed once, no matter how many different JBST controls you create.
4. Done!
Add your JBST control script and the support script to your webpage. Binding to a JBST control is as easy as it gets. Here's an example usage:
// get some data
var myData =
{
title: "Hello world",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia consequat diam, ac auctor eros suscipit et. Donec rhoncus bibendum scelerisque.",
timestamp: new Date(),
children: [
{ label: "The first item", selected: false },
{ label: "Another child item", selected: false },
{ label: "And again", selected: false },
{ label: "Final item", selected: false }
]
};
// randomly mark one as selected
myData.children[Math.floor(Math.random() * myData.children.length)].selected = true;
// bind the control to your data
var myList = Foo.MyZebraList.bind(myData);
// insert into the page
document.body.appendChild(myList);
Copyright ©2006-2010 Stephen M. McKamey. Powered by JsonFx.NET (v1.4.1003.3007).