easyUI常用方法
HTML <table id="tbList" striped="true" rownumbers="true" fix="true" fitcolumns="true" title="标题" idfield="ID" checkbox="true" url="@Url.Action("ListData")"> <thead> <tr> <th field="ID" checkbox="true" width="30"> </th> <th field="Name" width="200" align="center"> 名称 </th> </tr> </thead> </table> JS $("#tbList").datagrid({ pagination: true }); $("#btnSearch").click(function () {//查询方法 $("#tbList").datagrid("unselectAll"); $("#tbList").datagrid({ queryParams: { SearchName: $("#SearchName").val()} }); });
1.冻结列
$("#tbList").datagrid({ pagination: true, frozenColumns:
[[ { field: "BId",checkbox:"true",width:30}, { field: "BNo", title: "牌号", width: 100 }, { field: "FNo", title: "班号", width: 100 } ]], fitColumns:false //禁止自适应宽度、可以水平滚动 });
2.table中td内容太长自动换行
添加属性 nowrap="false";
将nowrap: false这个属性设置在table的属性中,不要设置在字段的属性中,字段可以设置宽度,这样就可以做到当文字长度超过规定的宽度后自动换行了,false为换行/true为不换行。
3.常用事件
- $("#cc").combogrid({
- onSelect:function(index,row){
- },
- onChange:function(newVal ,oldVal){
- alert("newVal:" +newVal);
- alert("oldVal:" +oldVal);
- alert("getValue:" + $("#cc").combogrid("getValue"));
- var g = $("#cc").combogrid("grid"); // get datagrid object
- var r = g.datagrid("getSelected"); // get the selected row
- if(r ==null)
- alert("null");
- else
- alert("not null");
- }
- });
4.校验表单完整性
//校验表单完整性
function checkForm() {
//获取需要校验的字段
var code = $("#code").val();
var name = $("#name").val();
//校验字段是否为空
if (name == "") {
inputTips("请输入合同名称", "name", false);
return false;
}
if (code == "") {
inputTips("请输入合同编号", "code", false);
return false;
}
return true;
}
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了