//不好用
function toClear(){
$('#orderNoId').attr("value",'');
}
$('#brandName').val("");//好用
別人的比較好的封裝例子,沒用過,好不好用就不清楚了。。
function clearForm(objE){//objE爲form表單
$(objE).find(':input').each(
function(){
switch(this.type){
case 'passsword':
case 'select-multiple':
case 'select-one':
case 'text':
case 'textarea':
$(this).val('');
break;
case 'checkbox':
case 'radio':
this.checked = false;
}
}
);
}
<form action="findGoodScore.action" method="post">
<input type="button" value="清空" onclick="clearForm(this.form)"/>
</form>
//清空表單裏的所有值
function clearForm(){
$('#queryForm').form('clear');
searchUser();
}
SyntaxError: missing ; before statement
function formatAlter(){
retun '<a href="javascript:void(0)" onclick="toReload();" class="easyui-linkbutton">修改</a>';
}
看出是哪裏錯了嗎,對,return寫錯了,結果報上面missing的錯誤。。
Query EasyUI的datagrid中formatter如何調用公共function?
formatter是一個處理函數, 帶有row value等參數, 可以在formatter的處理函數裏面調用任何公共function
$('#dg').datagrid({
columns:[[
{field:'userId',title:'User', width:80,
formatter: function(value,row,index){
return common(value);
}
}
]]
});
公共函數:
function common(val)
{
return val+"test";
}
easyUi datagrid設置行高度:
代碼例:
<div id="g" style="width: 100%;height: 100%">
<table id="gtable"></table>
</div>
<style>
#g .datagrid-btable tr{height: 40px;}
</style>
jquery easyui datagrid 單元格里如何顯示圖片?
在創建列的時候自己控制一下輸出內容就可以了
columns:[[ {title:'圖片',field:'image',width:100,align:'center', formatter:function(value,row,index){return '<img src="'+row.image+'" />';} } ]]
function showWin(onLoad) {
$("#win").window({
href:'brand/toAdd.do',
width:400,
height:300,
iconCls:'icon-edit',
modal:true,
shadow:false,
minimizable:false,
cache:'false',
maximizable:false,
collapsible:false,
resizable:false,
onload:onload
});
}
上面的代碼知道哪裏錯了嗎,,唉,時間就是這麼浪費的,把onload改成onLoad就好了。。
easyui datagrid 怎麼去除單擊行選中事件?
onClickRow: function (rowIndex, rowData) {
$(this).datagrid('unselectRow', rowIndex);
},
沒辦法,雞肋般的功能也能讓我找半天答案,這樣子的話,我真的能夠進步嗎。。。
解決了卻不用,這到底是什麼驅動我找答案的啊,效率低下。
<script type="text/javascript">
function rowformater(value,row,index)
{
return "<a href='"+row.id+"' target='_blank'>操作</a>";
}
</script>
表格裏的取值已經有三個參數之多了,想怎麼操作那一行的數據都行了,
也找了很久,才發現easyui已經提供了。
。post和。postJSON有什麼區別呢?
第一個需要自己指定返回數據的類型,第二個已經指定了返回json類型的數據