let grid = new w2grid({
name : 'grid',
url : 'server/side/path/to/records',
columns: [
{ field: 'recid', text: 'ID', size: '50px' },
{ field: 'lname', text: 'Last Name', size: '30%' },
{ field: 'fname', text: 'First Name', size: '30%' },
{ field: 'email', text: 'Email', size: '40%' },
{ field: 'sdate', text: 'End Date', size: '120px' }
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: 'jdoe@gmail.com', sdate: '4/23/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' }
]
});
xxxxxxxxxx
let grid = new w2grid({
name : 'grid',
url : 'server/side/path/to/records',
columns: [
{ field: 'recid', text: 'ID', size: '50px' },
{ field: 'lname', text: 'Last Name', size: '30%' },
{ field: 'fname', text: 'First Name', size: '30%' },
{ field: 'email', text: 'Email', size: '40%' },
{ field: 'sdate', text: 'End Date', size: '120px' }
]
});
xxxxxxxxxx
record = {
recid : null, // unique record id
[field-1] : '', // field 1
[field-2] : '', // field 2
[field-N] : '', // field N
w2ui : {
style : '', // additional CSS style for <tr ...> tag or for <td ...> tag if it is an object
class : '', // additional CSS class for <tr ...> tag or for <td ...> tag if it is an object
summary : false, // indicates if it is a summary record (summary records appear on the bottom)
editable : true, // indicate is record is editable (must have column.editable property set)
expanded : 'none', // can be true | false | 'none' | 'spinner'
changes : null, // readonly, object with user changes by inline editing
colspan : null, // colspan object, e.g. { field: 5, ...}
hideCheckBox : false, // hide checkbox for this record if grid.show.selectColumn is set
children : [], // array of record objects, can have sub children
parent_recid : null, // (internally set, id of the parent record, when children are copied to records array)
}
}