CSMJU jQuery Mobile

เมนู
ถัดไป ก่อนหน้า

3.6 Listviews

   List basics & API

  • Examples of all basic list swatches
  • 1 Swatch "a" on listview

    2 Swatch "b" on listview

    3 Swatch "c" on listview

    4 Swatch "d" on listview

    5 Swatch "e" on listview

    1.16 Calling the listview plugin

       สามารถเรียกใช้ listview plugin บน selector อื่นๆ เช่นเดียวกับการเรียกใช้ปลั๊กอินของ jQuery
    $('#mylist').listview();

    1.17 Updating lists

       สามารถเพิ่ม items ไปยัง listview โดยต้องเรียกใช้ method : refresh()เพื่อปรับปรุงรูปแบบ และสร้างรายการที่ซ้อนกัน เช่น
    $('#mylist').listview('refresh');

    
    หมายเหตุ: method refresh() จะมีผลต่อโหนดใหม่ผนวกเข้ากับรายการ(list)เท่านั้น
    ในรายการใดที่ได้รับการปรับปรุงแล้วจะถูกละเว้น ซึ่งหมายความว่า ถ้าคุณเปลี่ยนเนื้อหาหรือ attributes 
    ของรายการที่ปรับปรุงไปแล้ว รายการนั้นจะไม่ปรากฎ หากต้องการปรับปรุง list item สามารถใส่ fresh markupก่อนที่จะเรียกใช้ method refresได้
    และ สามารถเพิ่มclass: ui-screen-hidden ลงใน element :li ได้ ในกรณีที่ต้องการซ่อนlist item
    

    1 Listviews Option

       Listview plugin มี options ดังต่อไปนี้

    2 Listviews Medthod

       Listview plugin มี method ดังต่อไปนี้

    3 Listviews Events

       Listview plugin มี events ดังต่อไปนี้

       ผูก event ใน <ul> หรือ<ol> โดยใช้ virtual events หรือผูกกับ JavaScript events, like change, focus, blur ฯลฯ จากโค้ดดังต่อไปนี้

    
    $( ".selector" ).listview({
       create: function(event, ui) { ... }
    });