Jquery mobile theme is not working

时间秒杀一切 提交于 2019-12-24 15:30:56

问题


I'm adding LI dynamically on a ul by using jquery but the jquery mobile theme is not applying.

here is my code

 $('#employee_list').on("click", "a", function() {
            var li_id = this.id;            

            $("#chart").html(" ");
            var title = '<li id="visited"><a href="#" data-role="button" data-inline="true">True</a>';
            $("#main_child_ul").append(title);
            $('#org').trigger("create");



            $("#org").jOrgChart({
                chartElement : '#chart',
                dragAndDrop  : true
            });
            //$("#orgger").collapsibleset();

        });

and here is the html

<ul  id="org" style="display:none">
            <li id="visited"><a href="#" data-role="button" data-inline="true">True</a>
               <ul id="main_child_ul" class="children">

               </ul>
            </li>
        </ul> 

Any help? this is adding tree nodes dynamically but theme is not applying.


回答1:


When you add items to a listview, you will have to call the refresh() method to update the styles for the items which are added.

Ex:

$('#org').listview('refresh');

Let me know if it works.

Thanks



来源:https://stackoverflow.com/questions/18800238/jquery-mobile-theme-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!