Skip to content

Commit

Permalink
Cleaned up grid examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vitmalina committed Apr 18, 2013
1 parent 39cdccd commit db7e7be
Show file tree
Hide file tree
Showing 24 changed files with 74 additions and 102 deletions.
2 changes: 1 addition & 1 deletion demos/data/list2.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
{ recid: 43, fname: 'Wolfgang Amadeus', lname: 'Mozart', sdate: '1756-1791' },
{ recid: 44, fname: 'Johann Sebastian', lname: 'Bach', sdate: '1685-1750' },
{ recid: 45, fname: 'Richard', lname: 'Wagner', sdate: '1685-1750' },
{ recid: 46, fname: 'Joseph', lname: 'Haydn', sdate: '1732-1809', summary: true }
{ recid: 46, fname: 'Joseph', lname: 'Haydn', sdate: '1732-1809' }
]
}
2 changes: 0 additions & 2 deletions demos/examples/grid-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
url: 'data/list.json',
columns: [
{ field: 'fname', caption: 'First Name', size: '30%' },
Expand Down Expand Up @@ -66,7 +65,6 @@ <h2>JSON: data/list.json.js</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
url: 'data/list.json',
columns: [
{ field: 'fname', caption: 'First Name', size: '30%' },
Expand Down
4 changes: 0 additions & 4 deletions demos/examples/grid-13.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
multiSearch: false,
searches: [
{ field: 'lname', caption: 'Last Name', type: 'text' },
{ field: 'fname', caption: 'First Name', type: 'text' },
Expand Down Expand Up @@ -77,8 +75,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
multiSearch: false,
searches: [
{ field: 'lname', caption: 'Last Name', type: 'text' },
{ field: 'fname', caption: 'First Name', type: 'text' },
Expand Down
4 changes: 0 additions & 4 deletions demos/examples/grid-14.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
multiSearch: false,
searches: [
{ field: 'lname', caption: 'Last Name', type: 'text' },
{ field: 'fname', caption: 'First Name', type: 'text' },
Expand Down Expand Up @@ -81,8 +79,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
multiSearch: false,
searches: [
{ field: 'lname', caption: 'Last Name', type: 'text' },
{ field: 'fname', caption: 'First Name', type: 'text' },
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-15.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true
Expand Down Expand Up @@ -74,7 +73,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-16.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true
Expand Down Expand Up @@ -85,7 +84,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-17.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true,
Expand Down Expand Up @@ -82,7 +81,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true,
Expand Down
8 changes: 4 additions & 4 deletions demos/examples/grid-20.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ <h1>Render to a New Box</h1>
</div>

<div id="example_view">
<div id="grid1" style="width: 49%; float: left; height: 300px; border: 2px solid green; padding: 4px;"></div>
<div id="grid2" style="width: 49%; margin-left: 50%; height: 300px; border: 2px solid red; padding: 4px;"></div>
<div id="grid1" style="width: 49%; float: left; height: 300px; border: 2px solid green;"></div>
<div id="grid2" style="width: 49%; margin-left: 50%; height: 300px; border: 2px solid red;"></div>
<br>
<input type="button" value="Render into Green Box" onclick="$('#grid1').w2render('grid');">
<input type="button" value="Render into Red Box" onclick="$('#grid2').w2render('grid');">
Expand All @@ -17,8 +17,8 @@ <h1>Render to a New Box</h1>
<div id="example_html">
<h2>HTML</h2>
<textarea class="preview">
<div id="grid1" style="width: 49%; float: left; height: 300px; border: 2px solid green; padding: 4px;"></div>
<div id="grid2" style="width: 49%; margin-left: 50%; height: 300px; border: 2px solid red; padding: 4px;"></div>
<div id="grid1" style="width: 49%; float: left; height: 300px; border: 2px solid green;"></div>
<div id="grid2" style="width: 49%; margin-left: 50%; height: 300px; border: 2px solid red;"></div>
<br>
<input type="button" value="Render into Green Box" onclick="$('#grid1').w2render('grid');">
<input type="button" value="Render into Red Box" onclick="$('#grid2').w2render('grid');">
Expand Down
18 changes: 8 additions & 10 deletions demos/examples/grid-21.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true,
Expand All @@ -36,9 +35,9 @@ <h2>JavaScript</h2>
{ field: 'fname', caption: 'First Name', size: '30%', sortable: true, editable: { type: 'text', inTag: 'maxlength=30' } },
{ field: 'lname', caption: 'Last Name', size: '30%', sortable: true, editable: { type: 'text' } },
{ field: 'age', caption: 'Age', size: '70px', style: 'text-align: center', editable: { type: 'int', style: 'text-align: center' } },
{ field: 'sex', caption: 'Sex', size: '70px', editable: { type: 'list', items: ['Male', 'Female'] } },
{ field: 'sex', caption: 'Sex', size: '70px', editable: { type: 'text', inTag: "maxlength=1", style: 'text-align: center' } },
{ field: 'dbo', caption: 'DOB', size: '120px', editable: { type: 'date' } },
{ field: 'email', caption: 'Email', size: '40%', editable: { type: 'email' } },
{ field: 'email', caption: 'Email', size: '40%', editable: { type: 'text' } },
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: '[email protected]', sdate: '4/3/2012' },
Expand All @@ -65,20 +64,19 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: {
toolbar: true,
footer: true,
toolbarSave: true
},
columns: [
{ field: 'recid', caption: 'ID', size: '50px', sortable: true },
{ field: 'fname', caption: 'First Name', size: '30%', sortable: true, editable: { type: 'text', inTag: 'maxlength=30' } },
{ field: 'lname', caption: 'Last Name', size: '30%', sortable: true, editable: { type: 'text' } },
{ field: 'age', caption: 'Age', size: '70px', style: 'text-align: center', editable: { type: 'int', style: 'text-align: center' } },
{ field: 'sex', caption: 'Sex', size: '70px', editable: { type: 'list', items: ['Male', 'Female'] } },
{ field: 'dbo', caption: 'DOB', size: '120px', editable: { type: 'date' } },
{ field: 'email', caption: 'Email', size: '40%', editable: { type: 'email' } },
{ field: 'fname', caption: 'First Name', size: '30%', sortable: true, editable: { type: 'text', inTag: 'maxlength=30' }, resizable: true },
{ field: 'lname', caption: 'Last Name', size: '30%', sortable: true, editable: { type: 'text' }, resizable: true },
{ field: 'age', caption: 'Age', size: '70px', style: 'text-align: center', editable: { type: 'int', style: 'text-align: center' }, resizable: true },
{ field: 'sex', caption: 'Sex', size: '70px', editable: { type: 'text', inTag: "maxlength=1", style: 'text-align: center' }, resizable: true },
{ field: 'dbo', caption: 'DOB', size: '120px', editable: { type: 'date' }, resizable: true },
{ field: 'email', caption: 'Email', size: '40%', editable: { type: 'text' }, resizable: true },
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: '[email protected]', sdate: '4/3/2012' },
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-4.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: { footer: true },
recordsPerPage: 8,
searches: [
Expand Down Expand Up @@ -76,7 +75,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: { footer: true },
recordsPerPage: 8,
searches: [
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-5.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
recordsPerPage: 8,
show: { footer: true },
columns: [
Expand Down Expand Up @@ -94,7 +93,6 @@ <h2>JSON: data/list2.json.js</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
recordsPerPage: 8,
show: { footer: true },
columns: [
Expand Down
2 changes: 0 additions & 2 deletions demos/examples/grid-6.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ <h2>JavaScript</h2>
<textarea class="preview">
$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: { selectColumn: true },
multiSelect: false,
columns: [
Expand Down Expand Up @@ -65,7 +64,6 @@ <h2>JavaScript</h2>

$('#grid').w2grid({
name: 'grid',
header: 'List of Names',
show: { selectColumn: true },
multiSelect: false,
columns: [
Expand Down
2 changes: 1 addition & 1 deletion demos/examples/grid-7.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2>JavaScript</h2>
],
onExpand: function (target, eventData) {
if (w2ui.hasOwnProperty('subgrid-' + eventData.recid)) w2ui['subgrid-' + eventData.recid].destroy();
$('#'+ eventData.box_id).css({ padding: '3px', width: '520px', height: '200px' }).w2grid({
$('#'+ eventData.box_id).css({ margin: '3px', width: '520px', height: '200px' }).w2grid({
name: 'subgrid-' + eventData.recid,
fixedBody: true,
columns: [
Expand Down
10 changes: 5 additions & 5 deletions demos/examples/grid-8.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<div class="content">

<div id="example_title">
<h1>Sub Grids</h1>
<h1>Show/Hide Columns</h1>
If you need to show or hide column, you can do it on the fly without any problems. Just remember to refresh the grid.
</div>

<div id="example_view">
<div id="grid" style="width: 100%; height: 300px;"></div>
<br>
<input type="button" value="Toggle First Column"
onclick="w2ui['grid'].columns[0].hidden = !w2ui['grid'].columns[0].hidden; w2ui['grid'].refresh();">
onclick="if (w2ui['grid'].getColumn('lname').hidden) w2ui['grid'].showColumn('lname'); else w2ui['grid'].hideColumn('lname');">
<input type="button" value="Toggle Last Column"
onclick="w2ui['grid'].columns[3].hidden = !w2ui['grid'].columns[3].hidden; w2ui['grid'].refresh();">
onclick="if (w2ui['grid'].getColumn('sdate').hidden) w2ui['grid'].showColumn('sdate'); else w2ui['grid'].hideColumn('sdate');">
</div>

<div id="example_html">
Expand All @@ -20,9 +20,9 @@ <h2>HTML</h2>
<div id="grid" style="width: 100%; height: 300px;"></div>
<br>
<input type="button" value="Toggle First Column"
onclick="w2ui['grid'].columns[0].hidden = !w2ui['grid'].columns[0].hidden; w2ui['grid'].refresh();">
onclick="if (w2ui['grid'].getColumn('lname').hidden) w2ui['grid'].showColumn('lname'); else w2ui['grid'].hideColumn('lname');">
<input type="button" value="Toggle Last Column"
onclick="w2ui['grid'].columns[3].hidden = !w2ui['grid'].columns[3].hidden; w2ui['grid'].refresh();">
onclick="if (w2ui['grid'].getColumn('sdate').hidden) w2ui['grid'].showColumn('sdate'); else w2ui['grid'].hideColumn('sdate');">
</textarea>
</div>

Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -39,7 +39,7 @@ <h2>JavaScript</h2>
$(document).ready(function () {
$().w2destroy('layout'); // destroy if it was previously created

var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -38,7 +38,7 @@ <h2>JavaScript</h2>
$(document).ready(function () {
$().w2destroy('layout');

var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-3.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -54,7 +54,7 @@ <h2>JavaScript</h2>
<script>
$(document).ready(function () {
$().w2destroy('layout');
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-4.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;'
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;'
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -66,7 +66,7 @@ <h2>JavaScript</h2>
$(document).ready(function () {
$().w2destroy('layout');

var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;'
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;'
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-5.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;'
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;'
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -65,7 +65,7 @@ <h2>JavaScript</h2>
$(document).ready(function () {
$().w2destroy('layout');

var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;'
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;'
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
4 changes: 2 additions & 2 deletions demos/examples/layout-6.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h2>HTML</h2>
<div id="example_js">
<h2>JavaScript</h2>
<textarea class="preview">
var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand All @@ -70,7 +70,7 @@ <h2>JavaScript</h2>
$(document).ready(function () {
$().w2destroy('layout');

var pstyle = 'background-color: #F5F6F7; border: 1px solid #dfdfdf; padding: 5px;';
var pstyle = 'border: 1px solid #dfdfdf; padding: 5px;';
$('#layout').w2layout({
name: 'layout',
panels: [
Expand Down
Loading

0 comments on commit db7e7be

Please sign in to comment.