Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Kendo Mobile Listview模板在更改事件时获取移动交换机位置_Javascript_Jquery_Mobile_Kendo Mobile - Fatal编程技术网

Javascript Kendo Mobile Listview模板在更改事件时获取移动交换机位置

Javascript Kendo Mobile Listview模板在更改事件时获取移动交换机位置,javascript,jquery,mobile,kendo-mobile,Javascript,Jquery,Mobile,Kendo Mobile,我正在开发一个使用kendo UI mobile的解决方案,我有这样的自定义模板 <script type="text/x-kendo-template" id="customListViewTemplate"> #if(type === 'Input'){# #if(status === 'true'){# <a> #: name #</a>&l

我正在开发一个使用kendo UI mobile的解决方案,我有这样的自定义模板

<script type="text/x-kendo-template" id="customListViewTemplate">

                #if(type === 'Input'){#
                   #if(status === 'true'){#

                    <a> #: name #</a><img id="alarm_indicator" src="img/bullet.png">
                   #}else{#
                    <a> #: name #</a><img id="alarm_indicator" src="img/bullet_red.png">
                   #}#
                #}else{#

                 #if(outputconfig === 'true'){#
                        #if(status === 'true'){#
                            #var i = 1 #
                            #i++#
                            #alert('rr')#
                            #localStorage.setItem(i,1)#

                            <a> #: name #</a> <input id="mobile-switch" data-role="switch" index="1" data-change="app.watchguard.switchChange"  checked="checked" data-enable="false"/>
                        #}else{#
                            #var i = 1 #
                            #i++#

                            #localStorage.setItem(i,0)#
                            <a> #: name # </a>  <input id="mobile-switch" data-role="switch" index="2"data-change="app.watchguard.switchChange"  data-enable="false"/>
                        #}#

                  #}else{#

                        #if(status === 'true'){#
                            #var a = 1 #
                            #a++#

                            #localStorage.setItem(a,1)#

                            <a> #: name #</a> <input id="mobile-switch"  data-role="switch" data-change="app.watchguard.switchChange"  checked="checked" />

                        #}else{#

                            #var a = 1 #
                            #a++#

                            #localStorage.setItem(a,0)#

                            <a> #: name # </a>  <input id="mobile-switch" data-role="switch"  index="4" data-change="app.watchguard.switchChange" />
                        #}#

                    #}#
                #}#
</script>

#如果(类型==‘输入’){#
#如果(状态=='true'){#
#:姓名#
#}否则{#
#:姓名#
#}#
#}否则{#
#如果(outputconfig=='true'){#
#如果(状态=='true'){#
#变量i=1#
#我++#
#警报('rr')#
#localStorage.setItem(i,1)#
#:name#
#}否则{#
#变量i=1#
#我++#
#localStorage.setItem(i,0)#
#:name#
#}#
#}否则{#
#如果(状态=='true'){#
#变量a=1#
#a++#
#localStorage.setItem(a,1)#
#:name#
#}否则{#
#变量a=1#
#a++#
#localStorage.setItem(a,0)#
#:name#
#}#
#}#
#}#
在这里,它从数据源加载一个列表视图,右侧有一个移动开关按钮。(每个带有mobilw开关的列表项)问题是我需要通过on change()获取移动开关按钮的位置(例如:0,1,2)。我该怎么做?有人能帮我吗:-)

谢谢


Chinthaka将编写JS代码,因为我需要检查一些条件以相应地定位ui。我的问题是如何从onChangeapp.watchguard.switchChange获取移动交换机的位置:namespace.switchChange=函数(e){//我可以从e获取移动交换机的位置吗??}