Render to a New Box

When you create a grid it is not required to provide a containter, thus it creates a grid in memory. The example below illustrates how to create a grid in memory and render it when needed and where needed.

$(function () { $().w2grid({ name: 'grid', columns: [ { field: 'recid', caption: 'ID', size: '50px', sortable: true, attr: 'align=center' }, { field: 'lname', caption: 'Last Name', size: '30%', sortable: true }, { field: 'fname', caption: 'First Name', size: '30%', sortable: true }, { field: 'email', caption: 'Email', size: '40%' }, { field: 'sdate', caption: 'Start Date', size: '120px' }, ], records: [ { recid: 1, fname: 'Jane', lname: 'Doe', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 3, fname: 'Jin', lname: 'Franson', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' }, { recid: 6, fname: 'Francis', lname: 'Gatos', email: 'jdoe@gmail.com', sdate: '4/3/2012' } ] }); });