1.多次使用按鈕button。
<div id="buttons"> <a id="save_channelD" href="javascript:void(0);" class="easyui-linkbutton" data-options="width:70" onclick="javascript:savechannelD();">保存</a> </div>
不要加 data-options="width:70” 。應為給其設置寬度后,easy UI會把其作為流式布局,相對於父級定位,各個按鈕會表現奇葩。
easy UI 原文定義:
Fluid LinkButton
This example shows how to set the width of LinkButton to a percentage of its parent container.
鏈接地址:http://www.jeasyui.net/demo/364.html
2.easyui-datagrid不要重復設置 data-options=“url:…” 和 $('#bank_dg').datagrid({url: '..’}) ,會報錯。
<table id="bank_dg" title="" class="easyui-datagrid" style="width:100%;"> <thead> <tr> <th data-options="field:'plaName',width:40,align:'center'">平台名稱</th> <th data-options="field:'bankName',width:40,align:'center'">銀行名稱</th> <th data-options="field:'bankOpening',width:40,align:'center'">開戶行</th> <th data-options="field:'bankAccount',width:40,align:'center'">銀行賬號</th> <th data-options="field:'stockAmount',width:40,align:'center'">庫存金額</th> <th data-options="field:'stockBalance',width:40,align:'center'">在庫余額</th> <th data-options="field:'warningAmount',width:40,align:'center'">預警金額</th> <th data-options="field:'createTime',width:40,align:'center'">建檔時間</th> <th data-options="field:'refreshTime',width:40,align:'center'">更新時間</th> </tr> </thead> </table>
3. easyui-combobox ,easyui-datetimebox 類型獲取值於一般的$().val();不同,有各自的方法:
$('#sex').combobox('getValue'),
$('#InDate').datetimebox('getValue'),
4.清空easy UI輸入框 easyui-textbox 的值或下拉選擇框 easyui-combobox 的值。
用$().val(“ “),可以出發清空,但是easy UI有記憶回填機制,當你只是設置為空時,它會於上一次離開出發blur事件時的值對比,如果不同把原來的值回填。所以你會發現,原來以為清空的值再次點擊時,之前清空的值有神奇的再現了。。。
$("#channelNo").val("");//清空 $("#channelNm").val("");//清空
這么寫完全無效果???why????
這與easy UI 的demo結構有關。所填非所見。
基於這種渲染結構,改為如下:
$("#channelNo").parent().find("input").val("");//清空 $("#channelNm").parent().find("input").val("");//清空
很好點擊清空按鈕,輸入框內容清空了。
但是,在你再次點擊此清空后的輸入框時,之前清空的內容繼續回填了???
很簡單,用easy UI的方式對其設置,就沒問題了。
function resetQuery(){ $("#channelNo").textbox('setValue','')//賦值 $("#channelNm").textbox('setValue','')//賦值 $("#channelType").combobox('setValue',''); }
5.easy UI input 取值賦值。
$("#userdlg_useraccount").textbox('resize','140px');//設置寬度 $("#userdlg_useraccount").textbox('readonly',false);//設置可讀 $("#userdlg_useraccount").textbox('readonly',true);//設置只讀 var val = $("#userdlg_useraccount").textbox('getValue')//取值 $("#userdlg_useraccount").textbox('setValue','外星人')//賦值
6.easyui-combobox 下拉框高度。
(1)easyui-combobox下拉框默認高度為200px,繼承combo的高度,可以修改$.fn.combo.defaults下的 panelHeight:119,的值來改變高度。但這會把所有關聯下拉框高度都改變。
(2)如果只想對某個下拉框改變其高度可以這么設置:
$("#eventTypeId").combobox({panelHeight:200});
效果圖如下:
(3)如果某個下拉框其高度可以自動撐開:
$("#eventTypeId").combobox({panelHeight:"auto"});
效果圖如下: