详情
数据表格② datagrid 是否支持单选?
jiepot
2018-07-05 15:31:49
datagrid设置行选择默认都是多选,如果想做成只能选中一行应该怎么写?
回帖列表
huyaokuang905
2024-01-30 16:18:55
回复
网上正规实体现场同步靠谱平台
微信号 A2004721W 蝙蝠 74955240
飞机号【telegram】 @huyaokuang
??主营:百家乐??龙虎??牛牛??
??资金安全可靠、无需绑卡、支持多种存取方式 !
sunhao
2019-10-28 14:43:35
回复
不支持。
gowy111
2019-07-28 20:42:40
回复
送你了:
var
myDataGrid
=
$
(
'#myDataGrid'
).
datagrid
({
dataSource
:
{
cols
:
[
{
name
:
'title'
,
width
:
0.99
},
// { name: 'subtitle', width: 134 },
{
name
:
'check'
,
width
:
1
,
checkbox
:
true
,
style
:
{
visibility
:
'hidden'
}
}
],
array
:
items
,
cache
:
true
,
responsive
:
true
,
// [
// {title: '00:11:12', Subtitle:'111'},
// ]
},
onSelectRow
:
function
(
rowId
,
checked
,
selections
)
{
var
data1
=
JSON
.
stringify
(
selections
[
rowId
]);
var
count1
=
Object
.
getOwnPropertyNames
(
selections
).
length
;
// console.dir('count1=' + count1);
// console.dir(Object.getOwnPropertyNames(selections)[0]);
if
(
count1
>
1
)
{
for
(
var
i
=
0
;
i
<
count1
;
i
++)
{
var
thistimerowid
=
Object
.
getOwnPropertyNames
(
selections
)[
i
];
if
(
thistimerowid
!=
rowId
)
{
this
.
checkRow
(
thistimerowid
,
false
);
};
};
thistimerowid
=
null
;
};
console
.
dir
(
this
);
console
.
dir
(
Object
.
getOwnPropertyNames
(
selections
).
length
);
console
.
log
(
'行'
,
rowId
,
checked
?
'选中了'
:
'取消选中了'
,
data1
);
data1
=
null
;
count
=
null
;
},
1
/
1
发表回帖
×
回贴
©
SQL查询:
46
次内存占用:
4.00MB
PHP 执行时间:
0.02
秒
ZSITE
8.6
微信号 A2004721W 蝙蝠 74955240
飞机号【telegram】 @huyaokuang
??主营:百家乐??龙虎??牛牛??
??资金安全可靠、无需绑卡、支持多种存取方式 !
送你了:
var myDataGrid = $ ( '#myDataGrid' ). datagrid ({
dataSource : {
cols : [
{ name : 'title' , width : 0.99 },
// { name: 'subtitle', width: 134 },
{ name : 'check' , width : 1 , checkbox : true , style : { visibility : 'hidden' } }
],
array : items ,
cache : true ,
responsive : true ,
// [
// {title: '00:11:12', Subtitle:'111'},
// ]
},
onSelectRow : function ( rowId , checked , selections ) {
var data1 = JSON . stringify ( selections [ rowId ]);
var count1 = Object . getOwnPropertyNames ( selections ). length ;
// console.dir('count1=' + count1);
// console.dir(Object.getOwnPropertyNames(selections)[0]);
if ( count1 > 1 ) {
for ( var i = 0 ; i < count1 ; i ++) {
var thistimerowid = Object . getOwnPropertyNames ( selections )[ i ];
if ( thistimerowid != rowId ) {
this . checkRow ( thistimerowid , false );
};
};
thistimerowid = null ;
};
console . dir ( this );
console . dir ( Object . getOwnPropertyNames ( selections ). length );
console . log ( '行' , rowId , checked ? '选中了' : '取消选中了' , data1 );
data1 = null ;
count = null ;
},