easyUI

//获取所有树叶子节点 注册添加事件 if ($('#menu').tree('isLeaf', node.target)) 是否叶子节点

$(function(){
  $('#menu').tree({
    onClick: function(node){

      //判断是不是叶子节点 node.target,节点对象的target属性)
      if($('#menu').tree("isLeaf",node.target)){  
        //alert(node.text);
        var tabs = $("#tabs");

        //getTab方法为在面板选项中获取指定的选项卡,node.text为指定选项卡的名字
        var tab = tabs.tabs("getTab",node.text);  

        //if(tab)tab存在的情况,在js中,如果存在有值,则表示true,不存在或者为0,表示false
        if(tab){
          tabs.tabs("select",node.text);
        }else{
          tabs.tabs('add',{
          title:node.text,
          href: node.attributes.url,  //加载远程url数据到选项卡,这个url是加载的页面的地址
          closable:true,
          bodyCls:"content"  //添加css类文到面板中
          });
        }
      }
    }
  });
});

 

 

  •  tabs选项卡

function addTab(title, url){  
    if ($('#tt').tabs('exists', title)){ /* 判断以title未标题的选项是否存在 */ 
        $('#tt').tabs('select', title);  /* 选中当前选项卡进行展现 */
    } else { 
        /* iframe指定显示框 */
        var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';  
        $('#tt').tabs('add',{  /* tabs添加选项卡 ,add新增属性*/
            title:title,  
            content:content, /* 文本信息 */ 
            closable:true /* 可关闭的 */ 
        });  
    }  
} 

 

  • 通过请求数据创建表格

<!--定义表格,并且通过url访问json数据, fitColumns:true表示自动适应,singleSelect:true 表示选中单个
pageSize:20页面默认显示的数量,toolbar:toolbar工具栏  -->
<table class="easyui-datagrid" id="itemList" title="商品列表"
       data-options="singleSelect:false,collapsible:true,pagination:true,url:'/item/query',method:'get',pageSize:20,toolbar:toolbar">
    <thead>
        <tr>
            <th data-options="field:'ck',checkbox:true"></th>
            <th data-options="field:'id',width:60">商品ID</th>
            <th data-options="field:'title',width:200">商品标题</th>
            <th data-options="field:'cid',width:100,align:'center',formatter:KindEditorUtil.findItemName">叶子类目</th>
            <th data-options="field:'sellPoint',width:100">卖点</th>
            <th data-options="field:'price',width:70,align:'right',formatter:KindEditorUtil.formatPrice">价格</th>
            <th data-options="field:'num',width:70,align:'right'">库存数量</th>
            <th data-options="field:'barcode',width:100">条形码</th>
            <th data-options="field:'status',width:60,align:'center',formatter:KindEditorUtil.formatItemStatus">状态</th>
            <th data-options="field:'created',width:130,align:'center',formatter:KindEditorUtil.formatDateTime">创建日期</th>
            <th data-options="field:'updated',width:130,align:'center',formatter:KindEditorUtil.formatDateTime">更新日期</th>
        </tr>
    </thead>
</table>

 

 

  • 将数字字符串转换成数字:

//转化价格单位,将元转化为分
$("#itemAddForm [name=price]").val(eval($("#itemAddForm [name=priceView]").val()) * 100);
itemAddEditor.sync();//将输入的内容同步到多行文本中

 

转载于:https://www.cnblogs.com/gxlaqj/p/11540089.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值