如何禁用选定的复选框? [英] How to disable selected checkboxes ?

查看:104
本文介绍了如何禁用选定的复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.我正在开发我的项目.我正在使用复选框,组合框和一个按钮.我从组合框中选择了一个项目,让我说这是DR JOHN NHOJ教授,并且我单击了多个复选框.例如,Barcelona,Apple,NYC和bus被打上了DR JOHN NHOJ教授的行列.我单击保存按钮.到这里为止一切都还好.但是第二次尝试.我想禁用巴塞罗那苹果,NYC和公共汽车检查箱.例如,我将从组合框中选择另一个人,然后分配皇马;葡萄RI,为这个人训练.我不想看到启用了巴塞罗那,苹果,NYC和公共汽车复选框的功能.有什么解决方案吗?

Hello everyone. I am developing my project. I am using checkboxes, combobox and a button. I select an item from combobox let me say it is Prof DR JOHN NHOJ and I am clicking more than one check boxes. For example barcelona, apple, NYC and bus are ticked for Prof DR JOHN NHOJ. I am clicking save button. Until here everything is Ok. However for the second try. I want to disable barcelona apple, NYC and bus checboxes. For example I will chose another person from combobox and I will assign Real Madrid; grapes; RI, train for this person. I don''t want to see barcelona, apple, NYC and bus checkboxes enabled. Is there any solution ?

推荐答案

if(checkboxname.isSelected())
checkboxname.setEnabled(false);



是的.



I did.


是的,可能的.只需从数据源本身中筛选先前已选择的项目.

两种方式:
1.如果要获取每个人的数据,则可以在查询级别进行过滤.
2.如果要一次获取数据并一次又一次地使用,则需要编写自己的逻辑以从完整集中删除已选择的数据.

试试吧!
Yes, possible. Just filter the previous already selected items from the datasource itself.

Two ways:
1. If you are fetching data for every person then you can do the filtration at query level.
2. If you are fetching data once and using again & again, you need to write your own logic for already selected data removal from full set.

Try out!


这篇关于如何禁用选定的复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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