ej.base.enableRipple(true);
var data = [{OrderID: 10248, CustomerID: "VINET", Freight: 32.38, Currency: 'USD'}, {OrderID: 10249, CustomerID: "TOMSP", Freight: 11.61, Currency:'USD'}];
var grid = new ej.grids.Grid({
dataSource: data,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal', newRowPosition:'Top' },
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
columns: [
{
field: 'OrderID', isPrimaryKey: true, headerText: 'Order ID', textAlign: 'Right',
validationRules: { required: true, number: true }, width: 140
},
{
field: 'CustomerID', headerText: 'Customer ID',
validationRules: { required: true }, width: 140
},
{
field: 'Freight', headerText: 'Freight', textAlign: 'Right', editType: 'numericedit',
width: 140, format: 'C2', validationRules: { required: true }
},
{
field: 'Currency', editType: 'dropdownedit', width: 150,
edit: {
params: {
query: new ej.data.Query(),
dataSource: [{ text: 'USD' }, { text: 'GBP'}, { text: 'EUR'}],
fields:{text:'text',value:'text'}
}
}
}
],
});
grid.appendTo('#Grid');
|