Home > Web Front-end > JS Tutorial > Summary of various refresh methods for jquerymobile partial rendering_jquery

Summary of various refresh methods for jquerymobile partial rendering_jquery

WBOY
Release: 2016-05-16 16:57:13
Original
1138 people have browsed it

On the JQueryMobile page, an overall rendering is performed during the first initialization. Dynamically generated pages require partial rendering.

How to implement partial rendering of listview in jquerymobile:

Copy the code The code is as follows:

function queryPublishOrderList(trackOrDealOrInsp,userCode,type,pageNum){ 
    var queryPublishOrderListURL="http://xxx.xxx.xxx.xxx/Myapp/WorkOrderSelByTypeService.svc/WorkOrderSimpSelByType/Json/" trackOrDealOrInsp "/" userCode "/" type "/" pageNum; 
    $.ajax({ 
        type: 'get', 
        dataType : "json", 
        url: queryPublishOrderListURL, 
        contentType: 'application/json', 
        data: [], 
        success: function(data) { 
              var sb = new StringBuffer();  
              $.each(data, function(i,item){ 
                 //创建一个工单列表行对象 
                sb.append(""); 
              }); 
              var content = sb.toString();  
                 $("#queryList").html(content); 
        }, 
        error:function(XMLHttpRequest, textStatus, errorThrown){ 
                alert("请求远程服务错误!"); 
        }, 
        complete: function() {     
              $("p[data-role=content] ul").listview();           
        }   
    }); 
}

Remarks:

Listview refreshes the listview component for jquerymobile.

$("p[data-role=content] ul").listview();

If you want to refresh the li inside the listview, you can use

$("p[data-role=content] ul li").listview("refresh");

Otherwise the error will be 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

Copy code The code is as follows:

Generally, when logging in, there are two checkboxes for remembering username and password.

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

Solution:
[code]
$('input[type="checkbox"]').bind('click',function() {
$(this). prop('checked').checkboxradio("refresh"); // Bind events to update the checked value of the checkbox in time
});


If you want to use js to change the checkbox The value must also be refreshed in time.

$('input [type="checkbox"]').attr('checked',false).checkboxradio("refresh");
$('input [type="checkbox"] ').attr('checked',false).checkboxradio("refresh");

Cause: jquerymobile cannot re-render after manually changing its value. In this way, the value displayed on the page is different from the actual value. (jquerymobile hides all form elements, and then uses js to add some elements to beautify the effects of input, select, textarea and other elements)
[/code]
Drop-down box refresh
Copy code The code is as follows:

$("#selectbox").html(optionList).selectmenu('refresh', true ); 🎜>$("input[type='checkbox']").attr("checked",true).checkboxradio("refresh");
Radio button group:
$("input [type='radio']").attr("checked",true).checkboxradio("refresh"); $("input[type=range]").val( 60).slider("refresh");

Switch (they use slider):
var myswitch = $("select#bar");
myswitch[0].selectedIndex = 1;
myswitch .slider("refresh");



select disable style

button disabled styleui-btn-hidden mobile-button-disabled
ui-state- disabled
" type="button"
disabled="disabled"
value="not available"
aria-disabled="true">

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template