56 lines
1.1 KiB
HTML
56 lines
1.1 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>cartodb demo template</title>
|
||
|
</head>
|
||
|
|
||
|
<style>
|
||
|
body {
|
||
|
background-color: #FFF;
|
||
|
}
|
||
|
td {
|
||
|
border: 1px solid #333;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
|
||
|
<body>
|
||
|
<h1>table</h1>
|
||
|
<p>use console to modify cols variable, i.e:</p>
|
||
|
<pre>
|
||
|
cols.add({'id': 10, 'col1': 1, 'col2': 2, 'col3': 3});
|
||
|
cols.at(0).destroy()
|
||
|
</pre>
|
||
|
</body>
|
||
|
|
||
|
<script src="../../../src/cartodb.js"></script>
|
||
|
<script>
|
||
|
window.onload = function() {
|
||
|
cdb.load('../../../src/', function() {
|
||
|
cols = new cdb.ui.common.TableData();
|
||
|
|
||
|
tableMetadata = new cdb.ui.common.TableProperties({
|
||
|
schema: [
|
||
|
['id', 'number'],
|
||
|
['col1','number'],
|
||
|
['col2','number'],
|
||
|
['col3','number']
|
||
|
]
|
||
|
});
|
||
|
|
||
|
cols.reset([
|
||
|
{'id': 1, 'col1': 1, 'col2': 2, 'col3': 3},
|
||
|
{'id': 2, 'col1': 4, 'col2': 5, 'col3': 6}
|
||
|
]);
|
||
|
|
||
|
table = new cdb.ui.common.Table({
|
||
|
dataModel: cols,
|
||
|
model: tableMetadata
|
||
|
});
|
||
|
|
||
|
$('body').append(table.render().el);
|
||
|
});
|
||
|
};
|
||
|
</script>
|
||
|
</html>
|