首页 新闻 搜索 专区 学院

datagrid+combogird不能任意选数据

0
[已关闭问题] 关闭于 2018-08-05 09:29

问题 datagrid+combogrid 通过combogrid给datagird正在编辑的列赋值
现在的问题是只能固定选,不能随意选择任意一条赋值

代码:

field : 'content',
title : 'content',
editor : {
type:'combogrid',
options:{
panelWidth: 600,
idField: 'company' , //ID字段
textField: 'company' , //显示的字段 */
url: "${ctx}/sdata/notice/boxGrid?action=search",
fitColumns: true,
striped: true,
editable: true,
//是否分页
rownumbers: true, //序号
collapsible: true, //是否可折叠的
mode: 'remote',
method: 'post',

columns:[[
{field:'company',title:'标题',width:200},
{field:'office',title:'开始日期',width:100},
{field:'loginName',title:'结束日期',width:100,align:'right',editor:"text"},
{field:'no',title:'发布人',width:100,editor:'text'},
{field:'name',title:'发布内容',width:100,editor:"text"}
]],


onSelect: function (rowIndex, rowData) { //选中处理
/*
var grid = $('#dg');
alert(grid);
var rowIndex= grid.datagrid('getRowIndex',grid.datagrid('getSelected'));
alert(rowIndex);
grid.datagrid('beginEdit', rowIndex);
var editors = grid.datagrid('getEditors', rowIndex); */
alert('一'+rowIndex);
var title,startDate, endDate, issueUser,content;
title = $("#dg").datagrid('getEditor', { index : rowIndex, field: 'title' });
startDate = $("#dg").datagrid('getEditor', { index : rowIndex, field: 'startDate' });
endDate = $("#dg").datagrid('getEditor', { index : rowIndex, field: 'endDate' });
delFlag = $("#dg").datagrid('getEditor', { index : rowIndex, field: 'delFlag' });
content = $("#dg").datagrid('getEditor', { index :rowIndex, field: 'content' });
$(title.target).val(rowData.company); //赋值
$(startDate.target).val(rowData.office);//赋值
$(endDate.target).val(rowData.loginName);
$(delFlag.target).val(rowData.no);//赋值
$(content.target).val(rowData.name);//赋值

/* alert(rowIndex);
$('#dg').datagrid('updateRow', {
index: rowIndex, row: {
title : rowData.title,
startDate : rowData.startDate,
endDate : rowData.endDate,
content : rowData.content

} }) */

/* titles = rowData.company;
startDates = rowData.office;
endDates = rowData.loginName;
issueUsers = rowData.no;
contents = rowData.name; */

},

曾鉏清的主页 曾鉏清 | 初学一级 | 园豆:200
提问于:2018-08-02 17:49
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册