easyui 功能介绍

时间:2023-03-09 19:10:44
easyui 功能介绍

最近使用easyui,

下面,我介绍下常用功能:

easyui 功能介绍

//绑定Product总类型
$('#gdv_ProductParentType').datagrid({
url: '../api/BindData/GetProductParentType',
method: 'get', //默认是post,不允许对静态文件访问
width: '700',
rownumbers: true,
columns: [[
//绑定操作列
{field:'opt',title:'操作',width:100,align:'center',
formatter: function (value, rec, index) {
//通过传入PT_ID
var s = '<a href="#" title="View" mce_href="#" onclick="view(\'' + rec.PT_ID + '\')"><img class="viewButton"/></a> ';
var e = '<a href="#" title="Edit" mce_href="#" onclick="edit(\'' + rec.PT_ID + '\')"><img class="editButton"/></a> ';
var d = '<a href="#" title="Delete" mce_href="#" onclick="del(\'' + rec.PT_ID + '\')"><img class="delButton"/></a> ';
return s + "    " + e + "    " + d;
}
},
//这一列被隐藏了 hidden:true
{ field: 'PT_ID', title: 'PT_ID' ,hidden:true},
{ field: 'PT_Name', title: 'PT_Name' },
{ field: 'PT_CreateTime', title: 'PT_CreateTime',
//设定时间显示格式
formatter: function (value, row, index) {
var dt = new Date(value);
return dt.toLocaleDateString();
}
}
]],
//单击事件
onClickRow: function (index, row) {
BindProductChildType(1);
},
//工具栏
toolbar:[{
text:'Add',iconCls:'icon-add',handler:function(){
window.location.href='StuAdd.aspx';
}
}],
singleSelect: false, //允许选择多行
selectOnCheck: true,//true勾选会选择行,false勾选不选择行, 1.3以后有此选项
checkOnSelect: true //true选择行勾选,false选择行不勾选, 1.3以后有此选项
});