easyui的datagrid实例实现
功能要求如图所示:
function Loading() {
var editRow = undefined;//保存行的索引
var query= $("#myform").serializeObject();
$("#tabTopicList").datagrid({
url: 'Tools/GetTopicList.ashx',
queryParams:query,
pagination: true,
width: ,
height:,
pageSize: ,
pageList: [, ],
fit: true,
fitColumns: true,
nowarp: false,
idField: 'top_id',
sortName: 'top_createtime',
sortOrder: 'desc',
columns: [[
{ field: 'cbx', checkbox: true },
{
title: '类别',
field: 'cat_title',
width:,
editor: {
type: 'combobox',
options: {
required: true,
missingMessage: '请选择类别',
url: 'Tools/GetTopicCategory.ashx',
valueField: 'Cat_Id',
textField: 'Cat_Title',
onSelect: function (record) {
//重点在此处
//先获取到当前选中行
//根据当前行获取,当前行的下标
//在根据下标和要获取列的filed获取对应filed的Editor对象
//然后在根据对应的Editor操作
var row = $("#tabTopicList").datagrid('getSelected');
var rindex = $("#tabTopicList").datagrid('getRowIndex', row);
console.log(rindex);
var ed = $("#tabTopicList").datagrid('getEditor', {
index: rindex,
field: 'cat_title'
});
console.log($(ed.target).combobox('getText'));
var msg = $(ed.target).combobox('getText');
if (msg == '单选题') {
console.log();
var rows = getEditRow(rindex, 'top_answer');
//这里能对答案的combobox赋值为2
//$(rows.target).combobox('setValues','2');
//这里我以为能这样操作,
//既然可以操作方法, 为什么就不能重新定义data数据呢
//$(rows.target).combobox({
// data:[{
// label: 'A',
// value:'A'
// }, {
// label: 'B',
// value: 'B'
// },{
// label: 'C',
// value: 'C'
// }, {
// label: 'D',
// value: 'D'
// }]
//});
} else if (msg == '多选题') {
console.log();
var rows = getEditRow(rindex, 'top_answer');
$(rows.target).combobox('setValues', '');
}
},
}
}
},
{
title: '题目',
field: 'top_description',
width: ,
editor: {
type: 'validatebox',
options: {
required: true,
missingMessage: '请输入题目'
}
}
},
{
title: '选项A',
field: 'top_answera',
width: ,
editor: {
type: 'validatebox',
options: {
required: true,
missingMessage:'请输入选项A'
}
}
},
{
title: '选项B',
field: 'top_answerb',
width: ,
editor: {
type: 'validatebox',
options: {
required: true,
missingMessage: '请输入选项B'
}
}
},
{
title: '选项C',
field: 'top_answerc',
width: ,
editor: {
type: 'validatebox',
options: {
required: true,
missingMessage: '请输入选项C'
}
}
},
{
title: '选项D',
field: 'top_answerd',
width: ,
editor: {
type: 'validatebox',
options: {
required: true,
missingMessage: '请输入选项D'
}
}
},
{
title: '答案',
field: 'top_answer',
width: ,
editor: {
type: 'combobox',
options: {
required: true,
missingMessage: '请选择答案',
multiple: true,
editable: false,
valueField: 'label',
textField: 'value',
formatter:function (row) {
//console.log(row);
return "<input type=\"checkbox\" name=\"" + row.label + "\" id=\"" + row.value + "\"/>" + row.value;
},
onSelect:function (rec) {
//console.log(rec.value);
$("#" + rec.value).attr("checked", "checked");
},
onUnselect: function (rec) {
$("#" + rec.value).removeAttr("checked");
},
}
}
}, {
title: '类型',
field: 'top_name',
width: ,
editor: {
type: 'combobox',
options: {
required: true,
missingMessage: '请选择类型',
multiple: true,
editable: false,
valueField: 'Top_Id',
textField: 'Top_Name',
url: 'Tools/getTopicTypeList.ashx',
formatter: function (row) {
//console.log(row);
return "<input type=\"checkbox\" name=\"" + row.Top_Id + "\" id=\"" + row.Top_Id + "\"/>" + row.Top_Name;
},
}
}
},
{
title: '创建人',
field: 'sta_username',
width:
},
{
title: '创建时间',
field: 'top_createtime',
width:
}
]]
});
}
easyui的datagrid实例实现的更多相关文章
- schemaeasyui实例:SSh结合Easyui实现Datagrid的分页显示
查了好多资料,发现还是不全,干脆自己整理吧,最少保证在我的做法正确的,以免误导读者,也是给自己做个记载吧! 克日学习Easyui,发现非常好用,界面很雅观.将学习的心得在此写下,这篇博客写SSh结合E ...
- 实例:SSH结合Easyui实现Datagrid的批量删除功能
在我先前的基础上面添加批量删除功能.实现的效果如下 删除成功 通常情况下删除不应该真正删除,而是应该有一个标志flag,但flag=true表示状态可见,但flag=false表示状态不可见,为删除状 ...
- 实例:SSH结合Easyui实现Datagrid的新增功能和Validatebox的验证功能
在我前面一篇分页的基础上,新增了添加功能和添加过程中的Ajax与Validate的验证功能.其他的功能在后面的博客写来,如果对您有帮助,敬请关注. 先看一下实现的效果: (1)点击添加学生信息按键后跳 ...
- 实例:SSh结合Easyui实现Datagrid的分页显示
近日学习Easyui,发现非常好用,界面很美观.将学习的心得在此写下,这篇博客写SSh结合Easyui实现Datagrid的分页显示,其他的例如添加.修改.删除.批量删除等功能将在后面的博客一一写来. ...
- SSh结合Easyui实现Datagrid的分页显示
近日学习Easyui,发现非常好用,界面很美观.将学习的心得在此写下,这篇博客写SSh结合Easyui实现Datagrid的分页显示,其他的例如添加.修改.删除.批量删除等功能将在后面的博客一一写来. ...
- springMVC注解方式+easyUI+MYSQL配置实例
刚接触springMVC,使用的注解方式,也在学习阶段,所以把自己学习到的记下来.本文利用springMVC从数据库读取用户信息为例,分享一下. 1.准备相关架包及资源.因为使用springMVC+e ...
- easyUI 中datagrid 返回列隐藏方法
easyui的datagrid方法返回的列,有的值不需要显示可以使用hidden(属性进行隐藏) columns : [ [{ field : 'bailClass', title : '类别', w ...
- EasyUI 中 DataGrid 控件 列 如何绑定对象中的属性
EasyUI 中 DataGrid 控件 是我们经常用到的控件之一, 但是 DataGrid 控件 在绑定显示列时却不支持对象属性绑定. 模型如下: public class Manager impl ...
- easyui的datagrid行的某一列添加链接
通过formatter方法给easyui 的datagrid 每行增加操作链接. 效果图 jsp代码: <th field="url" width="100&quo ...
随机推荐
- [Solution] ASP.NET Identity(1) 快速入门
本节将介绍: ASP.NET Identity简介 快速入门 扩展 ASP.NET Identity简介 身份管理在ASP.NET中存在很长世间了,ASP.NET 开发团队已经学会了很多从客户的反馈. ...
- 订餐App回顾与总结
MY-HR 成员: 角色分配 学号 博客园 丘惠敏 PM项目经理 201406114203 http://www.cnblogs.com/qiuhuimin/ 郭明茵 用户 201406114204 ...
- [课程设计]Scrum日记本项目进度
Sprint 1时间:11.14-11.23 冲刺一这一阶段中主要实现的是界面和互交(已实现这两个功能) 燃尽图: 项目进度: 第一阶段:现阶段已经实现界面和互交. 第二阶段:进行填入信息,并记录日期 ...
- Node.js爬虫数据抓取乱码问题总结
一.非UTF-8页面处理 1.背景 windows-1251编码 比如俄语网站:https://vk.com/cciinniikk 可耻地发现是这种编码 所有这里主要说的是 Windows-1251( ...
- ok6410 android driver(10)
From this essay, we go to a new discussion "Android Hardware Abstraction Layer". In this e ...
- STL or Force --- CSU 1553: Good subsequence
Good subsequence Problem's Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1553 Mean: 给你一个长 ...
- js定时器调用参数的方法
var userName="Tony"; //根据用户名显示欢迎信息 function ss(_name){ alert("ss,"+_name); } 使用字 ...
- 模拟---LCR
HDU 2778 Description LCR is a simple game for three or more players. Each player starts with three ...
- linux下导入、导出mysql数据库命令 下载文件到本地
一.下载到本地 yum install lrzsz sz filename 下载 rz filename 上传 linux下导入.导出mysql数据库命令 一.导出数据库用mysqldump命 ...
- Web Service(一) 基础学习
1 基础的Web Service平台是XML+HTTP. 2 Web Service平台的元素包括:SOAP(Simple Object Access Protocol)简单对象访问协议: UDDI( ...