{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 }
]
}
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 }
],
SpecificColumns: ["Name"],
ColumnTitles: { Name: "Custom Title" }
}
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
],
Init: function() {
this.ApplyFilter("e"); // Returns number of matches ( 2 )
}
}
Adds the ability for the user to filter by column using a multi-select list. If the possible option count exceeds the threshold, it will use a text box instead.
{
_: TK.Table,
EnableFilter: true,
ThresholdFilterMultiselect: 4,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "John", Age: 25 },
{ Name: "David", Age: 25 },
{ Name: "Charles", Age: 25 },
{ Name: "James", Age: 27 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
]
}
Limit the number of visible rows. This is used in case a large number of rows is causing performance issues.
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
],
MaxRows: 2
}
{
_: TK.Table,
PageSize: 5,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "John", Age: 25 },
{ Name: "David", Age: 25 },
{ Name: "Charles", Age: 25 },
{ Name: "James", Age: 27 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 }
]
}
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
],
EnableCheckBoxes: true,
CheckboxCheck: function() {
var selectedRows = this.SelectedRows();
alert(selectedRows.length + " rows selected.");
}
}
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
],
Templates: {
Name: {
_: "td",
Init: function() {
this.innerHTML = this.Data.toUpperCase();
}
}
}
}
{
_: TK.Table,
Rows: [
{ Name: "Peter", Age: 25 },
{ Name: "Bob", Age: 27 },
{ Name: "Alice", Age: 30 },
],
Init: function() {
// Method 1
this.Rows.push({ Name: "James", Age: 32 });
this.Rows.push({ Name: "Smith", Age: 40 });
this.Refresh();
// Method 2
this.AddRow({ Name: "John", Age: 42 });
}
}
{
_: TK.AjaxTable,
Url: "ExampleData.txt",
Post: null, // A GET request will be executed unless 'Post' is not null
Update: function() {
// This function is called after data is loaded
}
}
{
_: TK.AjaxTable,
Url: "ExampleData.txt?sort=SORTBY&desc=SORTDESC&filter=FILTER",
Post: null, // A GET request will be executed unless 'Post' is not null
Update: function() {
// This function is called after data is loaded
}
}
{
Elements: {
AddTextButton: {
onclick: function() {
this.Parent.Elements.Table.AddRow({
Description: "",
Price: 0,
Count: 1
}, true);
}
},
Table: {
_: TK.AjaxTable,
Url: "ExampleData.txt",
Form: { _: TK.Form },
EnableRemoveButton: true,
Save: function(model, isDeleted) {
alert(model.Description + " " + (isDeleted ? "deleted" : "changed"));
}
}
}
}