Home >Web Front-end >HTML Tutorial >Various refreshes of jquerymobile partial rendering_html/css_WEB-ITnose

Various refreshes of jquerymobile partial rendering_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:03:101262browse

   在JQueryMobile页面在第一次初始化进行一次整体渲染,动态生成的需要局部渲染。

在jquerymobile实现listview局部渲染的方法:

Java代码  

  1. function queryPublishOrderList(trackOrDealOrInsp,userCode,type,pageNum){  
  2.     var queryPublishOrderListURL="http://xxx.xxx.xxx.xxx/Myapp/WorkOrderSelByTypeService.svc/WorkOrderSimpSelByType/Json/"+trackOrDealOrInsp+"/"+userCode+"/"+type+"/"+pageNum;  
  3.     $.ajax({  
  4.         type: 'get',  
  5.         dataType : "json",  
  6.         url: queryPublishOrderListURL,  
  7.         contentType: 'application/json',  
  8.         data: [],  
  9.         success: function(data) {  
  10.               var sb = new StringBuffer();   
  11.               $.each(data, function(i,item){  
  12.                  //创建一个工单列表行对象  
  13.                 sb.append("");
  14.           }); 🎜> },
  15. error:function(XMLHttpRequest, textStatus, errorThrown){
  16. alert("Request remote service error!");
  17. },
  18. Complete: function( ) {                                                                                      🎜>}
  19. Note:
  20. listview is refreshed for jquerymobile for listview component.
  21. $("div[data-role=content] ] ul").listview();
  22. If you want to refresh the li inside the listview, you can use
  23. $("div[data-role=content] ul li").listview(" refresh");
Otherwise, the error is reported as follows:

jquerymobile listviewcannot call methods on listview prior to initialization; attempted to call method 'refresh'

jquerymobile checkbox needs to be refreshed in time to obtain its accurate value

Java code

Generally available when logging in There are two checkbox multi-select boxes for remembering username and remembering password

Using jquerymobile to make the page, when the checkbox is checked, it cannot always get its correct value.

Solution:

$('input[type="checkbox"]').bind('click',function() {
  1. $(this).prop('checked').checkboxradio("refresh"); // The binding event updates the checked value of the checkbox in time
  2. });
  3. If you want to use js to change the value of the checkbox, you must refresh it in time.
  4. $('input [type="checkbox"]').attr('checked',false).checkboxradio("refresh");
  5. $('input [type="checkbox"]').attr('checked',false).checkboxradio("refresh");
  6. Reason: Because it is manual jquerymobile cannot re-render after changing its value. In this way, the value displayed on the page is different from the actual value. (jquerymobile hides the form elements, and then uses js to add some elements to beautify the effects of input, select, textarea and other elements)
  7. Refresh the drop-down box
  8. Java code
  9. $("#selectbox").html(optionList).selectmenu('refresh', true);

Java code
    1. Check button
    2. $("input[type='checkbox']").attr("checked",true).checkboxradio("refresh");
    3. Radio button group:
    4. $("input[type='radio']").attr("checked",true).checkboxradio("refresh");
    5. Select list::
    6. var myselect = $("select#foo");
    7. myselect[0].selectedIndex = 3;
    8. myselect.selectmenu("refresh");
    9. Slider
    10. $("input[type=range]").val(60).slider ("refresh");
    11. switch (they use slider):
    12. var myswitch = $("select#bar");
    13. myswitch [0].selectedIndex = 1;
    14. myswitch .slider("refresh");

    select disable style

    button disabled style

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn