我想在需要插入新行时选中复选框。当我在jsgrid中单击“+”时需要选中复选框
{ name: "isactive",
title: "IsActive",
type:"checkbox",
align: "center",
sorting: false,
filtering: false},
我想在需要插入新行时选中复选框。当我在jsgrid中单击“+”时需要选中复选框
{ name: "isactive",
title: "IsActive",
type:"checkbox",
align: "center",
sorting: false,
filtering: false},
重新定义你的复选框场insertTemplate
,所以,它的检查:
{
name: "MyField",
type:"checkbox",
insertTemplate: function() {
var $result = jsGrid.fields.checkbox.prototype.insertTemplate.call(this);
$result.prop("checked", true);
return $result;
}
}
//Assuming "+" is in any button
$('#button_id').click(function(){
$("#x").prop("checked",true);
});
此外,可以检查或取消选中复选框元件或使用类似于以下代码.prop()方法的单选按钮。
// Check #x
$("#x").prop("checked", true);
// Uncheck #x
$("#x").prop("checked", false);
我不知道你在说什么?你知道jsgrid? –
@AravindhGopi是的,它是jQuery的插件 –
@AravindhGopi你试过我的解决方案吗? –
感谢它工作:) –