Jquery EasyUI外掛程式

來源:互聯網
上載者:User

標籤:組合框   record   cti   下載   psi   移動   extend   如何   efault   

屬性

屬性是定義在 jQuery.fn.{plugin}.defaults。比如,dialog 的屬性是定義在 jQuery.fn.dialog.defaults。

事件

事件(回呼函數)也是定義在 jQuery.fn.{plugin}.defaults。

方法

調用方法的文法:$(‘selector‘).plugin(‘method‘, parameter);

其中:

  • selector 是 jquery 對象選取器。
  • plugin 是外掛程式名稱。
  • method 是與外掛程式相匹配的已存在方法。
  • parameter 是參數對象,可以是對象、字串...

方法是定義在 jQuery.fn.{plugin}.methods。每個方法有兩個參數:jq 和 param。第一個參數 ‘jq‘ 是必需的,引用 jQuery 對象。第二個參數 ‘param‘ 引用方法傳遞的實際參數。比如,要擴充 dialog 組件的方法名為 ‘mymove‘ 的方法,代碼如下:

$.extend($.fn.dialog.methods, {    mymove: function(jq, newposition){        return jq.each(function(){            $(this).dialog(‘move‘, newposition);        });    }});

現在您可以調用 ‘mymove‘ 方法來移動對話方塊(dialog)到指定的位置:

$(‘#dd‘).dialog(‘mymove‘, {    left: 200,    top: 100});
開始使用 jQuery EasyUI

下載庫,並在您的頁面中引用 EasyUI CSS 和 JavaScript 檔案。

<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="easyui/themes/icon.css"><script type="text/javascript" src="easyui/jquery-1.7.2.min.js"></script><script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>

一旦您引用了 EasyUI 必要的檔案,您就可以通過標記或者使用 JavaScript 來定義一個 EasyUI 組件。比如,要頂一個帶有可摺疊功能的面板,您需要編寫如下 HTML 程式碼:

<div id="p" class="easyui-panel" style="width:500px;height:200px;padding:10px;"    title="My Panel" iconCls="icon-save" collapsible="true">    The panel content</div>

當通過標記建立組件,‘data-options‘ 屬性被用來支援自版本 1.3 以來 HTML5 相容的屬性名稱。所以您可以如下重寫上面的代碼:

<div id="p" class="easyui-panel" style="width:500px;height:200px;padding:10px;"    title="My Panel" data-options="iconCls:‘icon-save‘,collapsible:true">    The panel content</div>

下面的代碼示範了如何建立一個綁定 ‘onSelect‘ 事件的組合框。

<input class="easyui-combobox" name="language"    data-options="    url:‘combobox_data.json‘,    valueField:‘id‘,    textField:‘text‘,    panelHeight:‘auto‘,    onSelect:function(record){    alert(record.text)    }">

 

Jquery EasyUI外掛程式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.