JavaScript
onload = function() {
// create some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
var products = [
{ id: 0, name: 'Widget', unitPrice: 23.43 },
{ id: 1, name: 'Gadget', unitPrice: 12.33 },
{ id: 2, name: 'Doohickey', unitPrice: 53.07 }
];
var data = [];
var dt = new Date();
for (var i = 0; i < 100; i++) {
data.push({
id: i,
date: new Date(dt.getFullYear(), i % 12, 25, i % 24, i % 60, i % 60),
time: new Date(dt.getFullYear(), i % 12, 25, i % 24, i % 60, i % 60),
country: countries[Math.floor(Math.random() * countries.length)],
product: products[Math.floor(Math.random() * products.length)].name,
amount: Math.random() * 10000 - 5000,
discount: Math.random() / 4
});
}
// grid with custom editors
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
keyActionTab: 'CycleOut',
autoGenerateColumns: false,
itemsSource: data,
columns: [
{ header: 'ID', binding: 'id', width: 40, isReadOnly: true },
{ header: 'Date', binding: 'date', dataType: 4},
{ header: 'Time', binding: 'time', format: 't' },
{ header: 'Country', binding: 'country' },
{ header: 'Product', binding: 'product' },
{ header: 'Amount', binding: 'amount', format: 'n2' }
],
//rowEditEnding: function() {
// console.log('rowEditEnding')
//},
//rowEditEnded: function() {
// console.log('rowEditEnded')
//}
});
new wijmo.grid.filter.FlexGridFilter(theGrid);
new CustomGridEditor(theGrid, 'time', wijmo.input.InputTime, {
format: 't',
min: new Date(2000, 1, 1, 7, 0),
max: new Date(2000, 1, 1, 22, 0),
step: 30
});
new CustomGridEditor(theGrid, 'country', wijmo.input.ComboBox, {
itemsSource: countries
});
new CustomGridEditor(theGrid, 'amount', wijmo.input.InputNumber, {
format: 'n2',
step: 10
});
// create an editor based on a ComboBox
var multiColumnEditor = new...