var data,
init_data="December",
DataKeyNames= {};
if ( document.URL.match(/bad_data/) ) {
init_data="Junk data";
}
if ( document.URL.match(/singleobject/) ) {
data = { 1:"January",2:"February",3:"March",4:"April",5:"May", 6:"June",7:"July",
8:"August",9:"September",10:"October",11:"November",12:"December" };
} else if ( document.URL.match(/one_dimens_ary_bool/) ) {
data = [ true, false ];
} else if ( document.URL.match(/one_dimens_ary_num/) ) {
data = [ 1,2,3,4 ];
} else if ( document.URL.match(/one_dimens_ary/) ) {
data = [ "January","February","March","April","May", "June","July",
"August","September","October","November","December" ];
} else if ( document.URL.match(/two_dimens_ary_num/) ) {
data = [[1,2],[3,4]];
} else if ( document.URL.match(/two_dimens_ary/) ) {
data = [ [ "January","February"],["March","April"],["May", "June","July",
"August","September","October","November","December" ]];
} else if ( document.URL.match(/ary_of_objs/) ) {
data = [ { 1:"January" }, { 2:"February" }, { 3:"March" }, { 4:"April" }, { 5:"May" }, { 6:"June" }, { 7:"July" },
{ 8:"August" }, { 9:"September" }, { 10:"October" }, { 11:"November" },{ 12:"December"} ];
} else if ( document.URL.match(/ary_of_mk_objs/) ) {
data = [ { 1:"January", 2:"February" }, { 3:"March", 4:"April" }, { 5:"May" }, { 6:"June" }, { 7:"July" },
{ 8:"August" }, { 9:"September" }, { 10:"October" }, { 11:"November" },{ 12:"December"} ];
} else if ( document.URL.match(/bad_key_names/) ) {
DataKeyNames = { "key": "mon_nm", "value": "mon_nm" };
data = [ {"mon_num":1, "mon_name":"January", "junk_key":"junk_val"},
{"mon_num":2, "mon_name":"February", "junk_key":"junk_val"},
{"mon_num":12, "mon_name":"December", "junk_key":"junk_val"}];
} else if ( document.URL.match(/custom_key_names/) ) {
DataKeyNames = { "key": "mon_num", "value": "mon_name" };
data = [ {"mon_num":1, "mon_name":"January", "junk_key":"junk_val"},
{"mon_num":2, "mon_name":"February", "junk_key":"junk_val"},
{"mon_num":3, "mon_name":"March", "junk_key":"junk_val"},
{"mon_num":4, "mon_name":"April", "junk_key":"junk_val"},
{"mon_num":5, "mon_name":"May", "junk_key":"junk_val"},
{"mon_num":6, "mon_name":"June", "junk_key":"junk_val"},
{"mon_num":7, "mon_name":"July", "junk_key":"junk_val"},
{"mon_num":8, "mon_name":"August", "junk_key":"junk_val"},
{"mon_num":9, "mon_name":"September", "junk_key":"junk_val"},
{"mon_num":10, "mon_name":"October", "junk_key":"junk_val"},
{"mon_num":11, "mon_name":"November", "junk_key":"junk_val"},
{"mon_num":12, "mon_name":"December", "junk_key":"junk_val"}];
} else {
data = { 1:"January",2:"February",3:"March",4:"April",5:"May", 6:"June",7:"July",
8:"August",9:"September",10:"October",11:"November",12:"December" };
}
if ( document.URL.match(/two_dimens_ary_num|one_dimens_ary_num|one_dimens_ary_bool/) ) {
$('input#selecttest').menuoptions({
"Data": data,
"onSelect": function(mo, data) {
console.log(mo, data.newVal, data.newCode, data.type );
},
"ClearBtn": true,
"ShowAt": 'bottom',
"Sort": []
});
$('input#scrolltest').menuoptions({
"Data": data,
"onSelect": function(mo, data) {
console.log(mo, data.newVal, data.newCode, data.type );
},
"ClearBtn": true,
"Height": 200,
"Sort": []
});
} else {
$('input#selecttest').menuoptions({
"Data": data,
"onSelect": function(mo, data) {
console.log(mo, data.newVal, data.newCode, data.type );
},
"DataKeyNames": DataKeyNames,
"ClearBtn": true,
"InitialValue": { 'val': init_data },
"ShowAt": 'bottom',
"NotInListWarns": false,
"Sort": []
});
$('input#scrolltest').menuoptions({
"Data": data,
"onSelect": function(mo, data) {
console.log(mo, data.newVal, data.newCode, data.type );
},
"ClearBtn": true,
"DataKeyNames": DataKeyNames,
"InitialValue": { 'val': init_data },
"NotInListWarns": false,
"Height": 200,
"Sort": []
});
}
$('button#menutest').on('click', function (e) {
var tst = $('input#selecttest').menuoptions('re_serialize',$('form#tst').serialize());
alert (tst);
});