$(
function
() {
$(
'#tblAppendGrid'
).appendGrid(
'init'
, {
caption:
'My CD Collections'
,
captionTooltip:
'This is my CD collection list!'
,
initRows: 1,
columns: [
{
name:
'Album'
, display:
'Album'
, type:
'text'
, ctrlAttr: { maxlength: 100 },
resizable:
true
, ctrlCss: { width:
'100%'
}, displayCss: {
'min-width'
:
'160px'
},
displayTooltip: { items:
'td'
, content:
'You can resize this column!'
}
},
{ name:
'Artist'
, display:
'Artist'
, type:
'ui-autocomplete'
, ctrlAttr: { maxlength: 100 }, ctrlCss: { width:
'100px'
}, uiOption: { source: [
'Theresa Fu'
,
'Arashi'
,
'Show Luo'
,
'Wonder Girls'
,
'Kelly Chen'
]} },
{ name:
'Year'
, display:
'Year'
, type:
'ui-spinner'
, ctrlAttr: { maxlength: 4 }, ctrlCss: { width:
'40px'
}, uiOption: { min: 2000, max:
new
Date().getFullYear()} },
{ name:
'Origin'
, display:
'Origin'
, type:
'ui-selectmenu'
, ctrlOptions: [
'Hong Kong'
,
'Taiwan'
,
'Japan'
,
'Korea'
,
'US'
,
'Others'
] },
{ name:
'StockIn'
, display:
'Stock In'
, type:
'ui-datepicker'
, ctrlAttr: { maxlength: 10 }, ctrlCss: { width:
'80px'
}, uiOption: { dateFormat:
'yy/mm/dd'
} },
{ name:
'Price'
, display:
'Price'
, type:
'text'
, ctrlAttr: { maxlength: 10, title:
'Please fill in the price!'
}, ctrlCss: { width:
'50px'
,
'text-align'
:
'right'
}, value: 0, uiTooltip: { show:
true
} }
],
initData: [
{
'Album'
:
'Dearest'
,
'Artist'
:
'Theresa Fu'
,
'Year'
:
'2009'
,
'Origin'
:
'Hong Kong'
,
'StockIn'
:
'2011/01/30'
,
'Price'
: 168.9 },
{
'Album'
:
'To be Free'
,
'Artist'
:
'Arashi'
,
'Year'
:
'2010'
,
'Origin'
:
'Japan'
,
'StockIn'
:
'2011/02/26'
,
'Price'
: 152.6 },
{
'Album'
:
'Count On Me'
,
'Artist'
:
'Show Luo'
,
'Year'
:
'2012'
,
'Origin'
:
'Taiwan'
,
'StockIn'
:
'2011/09/18'
,
'Price'
: 306.8 },
{
'Album'
:
'Wonder Party'
,
'Artist'
:
'Wonder Girls'
,
'Year'
:
'2012'
,
'Origin'
:
'Korea'
,
'StockIn'
:
'2013/01/14'
,
'Price'
: 108.6 },
{
'Album'
:
'Reflection'
,
'Artist'
:
'Kelly Chen'
,
'Year'
:
'2013'
,
'Origin'
:
'Hong Kong'
,
'StockIn'
:
'2013/02/16'
,
'Price'
: 138.2 }
]
});
});