Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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
Jquery 打开listview项目kendo ui的详细视图_Jquery_Kendo Ui_Kendo Mobile - Fatal编程技术网

Jquery 打开listview项目kendo ui的详细视图

Jquery 打开listview项目kendo ui的详细视图,jquery,kendo-ui,kendo-mobile,Jquery,Kendo Ui,Kendo Mobile,我试图让它这样当一个listview项目被点击时,一个模态视图出现在对象的所有细节中。我试图找出如何引用单击的listview项,但我有点不知所措。 与我的listview设置相同。 关于如何引用单击的项目的任何帮助都将非常有用 我发现了一些类似这样的文档,但我很难理解javascript var lvData = $('#eventFeed').data('kendoListView'); var index = $(this).parents('.event:first').in

我试图让它这样当一个listview项目被点击时,一个模态视图出现在对象的所有细节中。我试图找出如何引用单击的listview项,但我有点不知所措。 与我的listview设置相同。 关于如何引用单击的项目的任何帮助都将非常有用

我发现了一些类似这样的文档,但我很难理解javascript

   var lvData = $('#eventFeed').data('kendoListView');
   var index = $(this).parents('.event:first').index() + lvData.eventInfo._skip;

   var itemInfo = lvData.eventInfo._data[index];
   $('<div id="eventInfo"></div>').appendTo(document.body);
   $('views/eventInfo').kendoWindow();
第一:您可以将set id作为如下标志:

<a data-role="button" class="view" data-click="onClick" id="#=id#">Details</a>
 <script type="text/javascript">
    function onclick(e)
    {
        var dataSet = $('#eventfeed').data("kendoMobileListView").dataSource._data;
        var currentData;
        var curUID = e.sender.element.closest('li').attr('data-uid');
        for(var i=0; i < dataSet.length; i++)
        {
            if(dataSet[i].uid == curUID)
            {
                currentData = dataSet[i];
                break;
            }           
        }
        var template = kendo.template($("#javascriptTemplate").html());
        var htmlCode = template(currentData); //Execute the template
        $("#modal").html(htmlCode); //Append the result
        $("#modal").data("kendoMobileModalView").open();
    }
</script>
然后你的代码是这样的:

<a data-role="button" class="view" data-click="onClick" id="#=id#">Details</a>
 <script type="text/javascript">
    function onclick(e)
    {
        var dataSet = $('#eventfeed').data("kendoMobileListView").dataSource._data;
        var currentData;
        var curUID = e.sender.element.closest('li').attr('data-uid');
        for(var i=0; i < dataSet.length; i++)
        {
            if(dataSet[i].uid == curUID)
            {
                currentData = dataSet[i];
                break;
            }           
        }
        var template = kendo.template($("#javascriptTemplate").html());
        var htmlCode = template(currentData); //Execute the template
        $("#modal").html(htmlCode); //Append the result
        $("#modal").data("kendoMobileModalView").open();
    }
</script>

onClick数据似乎不像我更改JSFIDLE为onClick it errors设置参数时那样工作。真的很抱歉,这是我的错误。我还没有检查过。。。我更新了我的答案,您可以尝试: