我正在尝试向mobiscroll scroller添加第三个功能。首先是一些解释:我有4个定制的从“0”到“9”的轮子。用户可以在这里插入一个4位数字。mobiScroll - 点击额外按钮时重置轮子的值
除了标准的“取消”(“Abbrechen”)和“添加”(“OK”)按钮,我想实现一个复位(“Bestand”)按钮,将滚轮内的所有轮子设置为该值“0”。添加这个额外的按钮没有任何问题,但不幸的是添加了所需的功能。想要的功能只需将所有4个轮子的值重置为值“0”。继到目前为止我的代码:
初始化车轮....
var whl1 = {'1':'1',
'2':'2',
'3':'3',
'4':'4',
'5':'5',
'6':'6',
'7':'7',
'8':'8',
'9':'9',
'0':'0'};
var whl2 = {'1':'1',
'2':'2',
'3':'3',
'4':'4',
'5':'5',
'6':'6',
'7':'7',
'8':'8',
'9':'9',
'0':'0'};
var whl3 = {'1':'1',
'2':'2',
'3':'3',
'4':'4',
'5':'5',
'6':'6',
'7':'7',
'8':'8',
'9':'9',
'0':'0'};
var whl4 = {'1':'1',
'2':'2',
'3':'3',
'4':'4',
'5':'5',
'6':'6',
'7':'7',
'8':'8',
'9':'9',
'0':'0'};
var wheel = [{},{},{},{}];
wheel[0]['1000er'] = whl1;
wheel[1]['100er'] = whl2;
wheel[2]['10er'] = whl3;
wheel[3]['1er'] = whl4;
初始化的滚轮....(环内).......
$('#' + i +'').scroller({
display: 'modal',
mode: 'clickpick',
lang : 'de',
headerText: function(value) {
//Some Stuff in here
},
button3Text: "Bestand",
button3: function(){
// this function doesn't work................
$('#' + i +'').mobiscroll('setValue', ['0', '0', '0', '0']);
},
formatResult: function(data) {
// some other stuff in here
},
onSelect: function(valueText, inst) {
// some other stuff, too
},
wheels: wheel,
height: 40
});
我已经尝试了很多方法来实现功能性,但没有任何工作....没有人有一个想法,我该如何解决这个问题?因为我已经花了很多时间来解决这个问题(整整两天...),我会非常感谢每一个反应或一点暗示......感谢提前,祝你有个愉快的一周!
难道你也许还添加HTML代码来重现问题? – likeitlikeit 2013-05-13 14:01:58