根据可观察对象选中/取消选中kogrid复选框 [英] Check/uncheck kogrid checkbox based on an observable

查看:59
本文介绍了根据可观察对象选中/取消选中kogrid复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 kogrid 其中我认为  使用 默认复选框检查/取消选中   列表 绑定它。   我选中/取消选中此复选框时,它应适当更新 selectedItems属性。我检查了cellTemplate。但我无法 识别  使用它。 


< pre lang = HTML>
< div style = height:650px; width:99%;数据 - bind = koGrid:{data:allList,displaySelectionCheckbox:true,multiSelect:true,selectWithCheckboxOnly:true,selectedItems:selectedList,
footerVisible:false,disableTextSelection:false,
afterSelectionChange:function(rowItem){return true;},

columnDefs:[{field:'Name',displayName:'Name ',width:'20%',headerTemplate:'koHeader'},

{field:'Country',displayName:'Country',width:'20%',headerTemplate:'koHeader'} ,
{field:'DOB',displayName:'DOB',width:'20%',headerTemplate:'koHeader'},
{field:'Profession',displayName:'Profession',width :'20%',headerTemplate:'koHeader'},

{field:'IsToBeChecked',d isplayName:'Selection',width:'30%',headerClass:'koHeader'},


]
}
>
< / div>





从上面的html代码中,IsToBeChecked是displaySelectionCheckbox应该基于的列可以选中或取消选中。



有人会建议我如何根据值检查/取消选中默认复选框吗?

解决方案

I am using kogrid where i thought of using the default checkbox and check/uncheck it based on a value from the list that is being bound to it. And also when i check/uncheck this checkbox, it should update the selectedItems property appropriately. I checked cellTemplate. But I am unable to identify how to use it.


<pre lang="HTML">
    <div style="height: 650px; width: 99%;" data-bind="koGrid: { data: allList,displaySelectionCheckbox: true, multiSelect :true, selectWithCheckboxOnly: true,  selectedItems: selectedList ,
                    footerVisible : false, disableTextSelection: false,
                    afterSelectionChange: function (rowItem) { return true; },

        columnDefs: [{ field: 'Name', displayName: 'Name', width: '20%' ,headerTemplate: 'koHeader'  },

                    { field: 'Country', displayName: 'Country', width: '20%' ,headerTemplate: 'koHeader' },
                    { field: 'DOB', displayName: 'DOB', width: '20%' ,headerTemplate: 'koHeader' },
                    { field: 'Profession', displayName: 'Profession', width: '20%' ,headerTemplate: 'koHeader' },

                    {field: 'IsToBeChecked', displayName: 'Selection', width: '30%',  headerClass: 'koHeader'},


        ]
        }">
    </div>



From the above html code, IsToBeChecked is the column based on which the 'displaySelectionCheckbox' should be checked or unchecked.

Could some one suggest me how check/uncheck the default checkbox based on a value?

解决方案

这篇关于根据可观察对象选中/取消选中kogrid复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆