Well, I’ve got some bad news – while it’s really simple to make a table out of the JSON, I can’t seem to hook the TableKit code to run on the generated table. It just won’t work. Sorry about that. Here’s the script to try it out there – you can see the table anyway.
In your second row of the table, make the content of the three cells as follows:
#{first} #{second} #{third}
Make note of the table’s Name/ID or Title (Freeway 6 or Freeway < 6). In the following code block, substitute that value EXACTLY for item1
in the first line.
var table = $('item1').down('table');
var tpl = new Template(table.down('tbody > tr').remove().outerHTML);
new Ajax.Request('colors.js', {
method: 'get',
onSuccess: function(transport){
var colors = eval(transport.responseText);
colors.each(function(ary){
var obj = {first: ary[0], second: ary[1], third: ary[2]};
table.down('tbody').insert(tpl.evaluate(obj));
});
}
});
Paste that code into the DOM Loaded Observer editor in Protaculous 2. (Apply Protaculous 2 to the page, look in the Actions palette for that control.)
TableKit will set up the table for sorting, but any click on a header will result in an error, because at the moment that the TableKit JavaScript runs, the table has no rows in its tbody element, and the TableKit setup only runs once – before the JavaScript callback has populated the table with its new rows.
Walter
On May 22, 2013, at 11:07 AM, DTP2 wrote:
The colors.js file is done. Well explained!
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options