帖子
帖子
用户
博客
课程
显示全部楼层
177
帖子
0
勋章
1万+
Y币

selectList模块(界面布局-列表)demo示例

[复制链接]
发表于 2018-3-17 23:54:24
  1. <!DOCTYPE html>
  2. <html>
  3.         <head>
  4.                 <meta charset="utf-8">
  5.                 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6.                 <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7.                 <title>title</title>
  8.                 <link rel="stylesheet" type="text/css" href="../css/api.css" />
  9.                 <style>
  10.                         body {
  11.                         }
  12.                         html, body {
  13.                                 height: 100%
  14.                         }
  15.                         body {
  16.                                 background-color: #fff;
  17.                                 margin: 0;
  18.                         }
  19.                         a.button {
  20.                                 display: -webkit-box;
  21.                                 -webkit-box-orient: vertical;
  22.                                 -webkit-box-pack: center;
  23.                                 -webkit-box-align: center;
  24.                                 height: 32px;
  25.                                 margin: 8px;
  26.                                 background-color: rgba(240, 240, 240, 1.0);
  27.                                 border-color: rgba(220, 220, 220, 1.0);
  28.                                 border-width: none;
  29.                         }
  30.                         a.active {
  31.                                 background-color: rgba(240, 240, 240, 0.7);
  32.                         }
  33.                 </style>
  34.         </head>
  35.         <body>
  36.                 <a class="button" tapmode="active" onclick="fnClose()">关闭selectlist</a>
  37.                 <a class="button" tapmode="active" onclick="fnShow()">显示列表视图</a>
  38.                 <a class="button" tapmode="active" onclick="fnHide()">隐藏selectList列表视图</a>
  39.                 <a class="button" tapmode="active" onclick="fnDeleteItem()">删除指定索引的数据</a>
  40.                 <a class="button" tapmode="active" onclick="fnInsertItem()">插入指定索引的数据</a>
  41.                 <a class="button" tapmode="active" onclick="fnRefreshItem()">刷新指定index条目的数据</a>
  42.                 <a class="button" tapmode="active" onclick="fnSetSelected()">设置选中的条目</a>
  43.                 <a class="button" tapmode="active" onclick="fnGetSortedData()">获取排序后的所有的数据</a>
  44.                 <br />
  45.                 <br />
  46.                 <br />
  47.                 <br />
  48.                 <br />
  49.                 <br />
  50.                 <br />
  51.                 <br />
  52.                 <br />
  53.                 <br />
  54.                 <br />
  55.                 <br />
  56.                 <br />
  57.         </body>
  58.         <script type="text/javascript" src="../script/api.js"></script>
  59.         <script type="text/javascript">
  60.                 var demo;
  61.                 apiready = function() {
  62.                         demo = api.require('selectList');
  63.                         fnOpen();
  64.                 };
  65.                 function fnOpen() {
  66.                         demo.open({
  67.                                 x : 0,
  68.                                 y : api.frameHeight - 250,
  69.                                 w : api.frameWidth,
  70.                                 h : 250,
  71.                                 contents : [{
  72.                                         title : '阿宝',
  73.                                         subTitle : '131313131313'
  74.                                 }, {
  75.                                         title : '阿宝',
  76.                                         subTitle : '131313131313'
  77.                                 }, {
  78.                                         title : '阿宝',
  79.                                         subTitle : '131313131313'
  80.                                 }, {
  81.                                         title : '阿宝',
  82.                                         subTitle : '131313131313'
  83.                                 }, {
  84.                                         title : '阿宝',
  85.                                         subTitle : '131313131313'
  86.                                 }, {
  87.                                         title : '阿宝',
  88.                                         subTitle : '131313131313'
  89.                                 }, {
  90.                                         title : '阿宝',
  91.                                         subTitle : '131313131313'
  92.                                 }, {
  93.                                         title : '阿宝',
  94.                                         subTitle : '131313131313'
  95.                                 }],
  96.                                 fixedOn : api.frameName,
  97.                         }, function(ret, err) {
  98.                                 if (ret) {
  99.                                         //alert(JSON.stringify(ret));
  100.                                         id=ret.id;
  101.                                 } else {
  102.                                         alert(JSON.stringify(err));
  103.                                 }
  104.                         });
  105.                 }

  106.                 function fnClose() {
  107.                         demo.close({
  108.                                 id : id
  109.                         });
  110.                 }

  111.                 function fnShow() {
  112.                         demo.show({
  113.                                 id : id
  114.                         });
  115.                 }

  116.                 function fnHide() {
  117.                         demo.hide({
  118.                                 id : id
  119.                         });
  120.                 }

  121.                 function fnDeleteItem() {
  122.                         demo.deleteItem({
  123.                                 id : id,
  124.                                 index : 2
  125.                         });
  126.                 }

  127.                 function fnInsertItem() {
  128.                         demo.insertItem({
  129.                                 id : id,
  130.                                 index : 2,
  131.                                 content : {
  132.                                         title : 'APICloud',
  133.                                         subTitle : '000000000'
  134.                                 }
  135.                         });
  136.                 }

  137.                 function fnRefreshItem() {
  138.                         demo.refreshItem({
  139.                                 id : id,
  140.                                 index : 2,
  141.                                 content : {
  142.                                         title : 'apitest',
  143.                                         subTitle : '111111'
  144.                                 }
  145.                         });
  146.                 }

  147.                 function fnSetSelected() {
  148.                         demo.setSelected({
  149.                                 id : id,
  150.                                 index : 2,
  151.                         });
  152.                 }

  153.                 function fnGetSortedData() {
  154.                         demo.getSortedData({
  155.                                 id : id
  156.                         }, function(ret, err) {
  157.                                 if (ret) {
  158.                                         alert(JSON.stringify(ret));
  159.                                 } else {
  160.                                         alert(JSON.stringify(err));
  161.                                 }
  162.                         });
  163.                 }
  164.         </script>
  165. </html>
复制代码
selectList模块demo

本帖子中包含更多资源,您需要 登录 才可以下载或查看,没有帐号?立即注册

X
您需要登录后才可以回帖 登录

本版积分规则