变速轮功能如何工作? [英] Changewheel functionality How it works?

查看:110
本文介绍了变速轮功能如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想分享一下使用此代码段所做的出色工作(它确实是一个很酷的工具).

First of all I want share my appreciation for the amazing work done with this snippet (it's really really a cool tool).

我正在尝试在当前正在开发的应用程序中使用mobiscroll.我喜欢使用和自定义mobiscroll工具有多么容易.

I am trying to use mobiscroll in an app that I am currently developing. I love how easy is to use and customize the mobiscroll tool.

我真正发现的只是晦涩难懂的是,如何使用功能changeWheel .我尝试了很多事情,但从未成功.

What I really find just obscure, is how use the functionality changeWheel. I tried many things but never with success.

我要完成的工作是更改第一个车轮的值(完全更改并重新生成第一个车轮),而在第二个车轮中,我选择了(实际上我想要的是一个on change事件)中的两个参数存在.

What I am trying to accomplish is to change the values of the first wheel (change completely and regenerate the first wheel), when in my second wheel I select (actually what I want is an on change event) one of the two parameters present.

我建立了一个函数,该函数创建两个轮子的数组,并相对于返回的第二个轮子的索引更改第一个轮子的数组. (我可以看到该函数有效,并且可以为车轮生成确切的值.)

I build up a function that create the arrays for the two wheels, and that change array of the first wheel relatively to the index of the second wheel returned. (I can see that the function works, and that it generate the exact values for the wheels).

然后我如何使用功能转盘在inst上的onchange事件上实现此功能?

此功能拨轮是否应该执行我想要的操作?

Is this function changewheel suppose to do what I am looking for?

非常清楚,请以示例为例:

一个人的第一轮重量 第二轮测量单位(kg或Lbs)

first wheel weight of a person second wheel unit of measurement (kg or Lbs)

如果我当场将Lbs更改为Kg,我希望第一个轮子反映变化(更新可用值)-例如,如果我将极限重量设置为0到80kg,则对应的磅值必须介​​于0和177lbs(整个转换由另一个自定义函数分别处理,并且完全按照我的要求工作).

If I change on the spot Lbs to Kg, I want that the first wheel reflect the changes (updating the values available) - if for example i set the limit weight between 0 and 80kg the correspondent value in lbs need to be between 0 and 177lbs (the whole conversion is handled separately with another customized function, and it works exactly as I want).

我不知道该如何实施changewheel事件....一个例子或更深入的解释将非常有用.

非常感谢你 最好 迪努兹

Thank you so much Best Dinuz

推荐答案

这里有一个简单的解释,如果要更新不同种类的值,则需要传递mobiscroll的实例并调用方法选项

here goes a simple explanation, if you want to update the values of a diferent whell you need to pass the instance of the mobiscroll and call the method options

$(function(){
         var filtersMetrics = [{}];
        var wheelPosMetrics = []
        var wheelPosFunc1 = [];
        var wheelPosFunc = [];

        wheelPosMetrics[0] = "Connection";
        wheelPosMetrics[1] = "Shared";
        wheelPosMetrics[2] = "Deleted";

        filtersMetrics[0]['Metrics']=wheelPosMetrics;

        wheelPosFunc1[0] = "Count";

        wheelPosFunc[0] = "Count";
        wheelPosFunc[1] = "Sum";
        wheelPosFunc[2] = "Avg";

        filtersMetrics[0]['Func']=wheelPosFunc1;


        var metricsScroller = $("#select").mobiscroll().scroller({
            theme : 'android',
            display : 'inline',
            mode: 'scroller',
            wheels: filtersMetrics,
            rows: 3,
            'onChange' : function(v, i , e){


                if(v[0]==1){
                    filtersMetrics[0]['Func']=wheelPosFunc;
                    metricsScroller.mobiscroll('option', 'wheels', filtersMetrics); 
                }else{
                    filtersMetrics[0]['Func']=wheelPosFunc1;
                    metricsScroller.mobiscroll('option', 'wheels', filtersMetrics);
                }



            }
        });

});

我使用了2.5版本

这篇关于变速轮功能如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆