W2UI Demo: grid-21
by ilancopelyn
HTML
<link rel="stylesheet" href="http://w2ui.com/src/w2ui-1.4.min.css">
<script src="http://w2ui.com/src/w2ui-1.4.min.js"></script>
<div id="grid" style="width: 100%; height: 400px;"></div>
<br>
<input type="button" onclick="showChanged()" value="Get Changed">
JavaScript
$(function () {
$('#grid').w2grid({
name: 'grid',
show: {
toolbar: true,
footer: true,
toolbarSave: true
},
columns: [
{ field: 'fname', caption: 'First Name', size: '120px', sortable: true, resizable: true,
editable: { type: 'text', inTag: 'maxlength=30' }
},
{ field: 'lname', caption: 'Last Name', size: '200px', sortable: true, resizable: true,
editable: { type: 'text' }
},
{ field: 'age', caption: 'Age', size: '70px', style: 'text-align: center', resizable: true,
editable: { type: 'int', style: 'text-align: center' }
},
{ field: 'sex', caption: 'Sex', size: '70px', resizable: true, style: "text-align: center",
editable: { type: 'list', inTag: "maxlength=1", style: 'text-align: center' }
},
{ field: 'dbo', caption: 'DOB', size: '120px', resizable: true,
editable: { type: 'date' }
},
{ field: 'email', caption: 'Email', size: '40%', resizable: true,
editable: { type: 'email' }
},
],
records: [
{ recid: 1, fname: 'Jane', lname: 'Doe', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver\'s "Color" Guy', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 7, fname: 'Mark', lname: 'Welldo', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 8, fname: 'Thomas', lname: 'Bahh', email: '[email protected]', sdate: '4/3/2012' },
{ recid: 9, fname: 'Sergei', lname: 'Rachmaninov', email: '[email protected]', sdate: '4/3/2012',
style: 'background-color: #ffcccc', editable: false }
]
});
});
function showChanged()...